"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "scripts/code.angularjs.org-firebase/functions/index.js" between
angular.js-1.7.9.tar.gz and angular.js-1.8.0.tar.gz

About: AngularJS is a web application framework that assists with creating single-page applications that only require HTML, CSS, and JavaScript on the client side.

index.js  (angular.js-1.7.9):index.js  (angular.js-1.8.0)
'use strict'; 'use strict';
const functions = require('firebase-functions'); const functions = require('firebase-functions');
const gcs = require('@google-cloud/storage')(); const {Storage} = require('@google-cloud/storage');
const path = require('path'); const path = require('path');
const storage = new Storage();
const gcsBucketId = `${process.env.GCLOUD_PROJECT}.appspot.com`; const gcsBucketId = `${process.env.GCLOUD_PROJECT}.appspot.com`;
const BROWSER_CACHE_DURATION = 60 * 10; const BROWSER_CACHE_DURATION = 60 * 10;
const CDN_CACHE_DURATION = 60 * 60 * 12; const CDN_CACHE_DURATION = 60 * 60 * 12;
function sendStoredFile(request, response) { function sendStoredFile(request, response) {
const requestPath = request.path || '/'; // Request paths will be URI-encoded, so we need to decode them to match the f
ile names in the
// storage bucket. Failing to do so will result in a 404 error from the bucket
and `index.html`
// will be returned instead.
// Example of path requiring decoding: `.../input%5Btext%5D.html` --> `.../inp
ut[text].html`
const requestPath = decodeURI(request.path || '/');
let filePathSegments = requestPath.split('/').filter((segment) => { let filePathSegments = requestPath.split('/').filter((segment) => {
// Remove empty leading or trailing path parts // Remove empty leading or trailing path parts
return segment !== ''; return segment !== '';
}); });
const version = filePathSegments[0]; const version = filePathSegments[0];
const isDocsPath = filePathSegments[1] === 'docs'; const isDocsPath = filePathSegments[1] === 'docs';
const lastSegment = filePathSegments[filePathSegments.length - 1]; const lastSegment = filePathSegments[filePathSegments.length - 1];
const bucket = gcs.bucket(gcsBucketId); const bucket = storage.bucket(gcsBucketId);
let downloadSource; let downloadSource;
let fileName; let fileName;
if (isDocsPath && filePathSegments.length === 2) { if (isDocsPath && filePathSegments.length === 2) {
fileName = 'index.html'; fileName = 'index.html';
filePathSegments = [version, 'docs', fileName]; filePathSegments = [version, 'docs', fileName];
} else { } else {
fileName = lastSegment; fileName = lastSegment;
} }
skipping to change at line 198 skipping to change at line 203
} }
} }
const snapshotRegex = /^snapshot(-stable)?\//; const snapshotRegex = /^snapshot(-stable)?\//;
/** /**
* The build folder contains a zip file that is unique per build. * The build folder contains a zip file that is unique per build.
* When a new zip file is uploaded into snapshot or snapshot-stable, * When a new zip file is uploaded into snapshot or snapshot-stable,
* delete the previous zip file. * delete the previous zip file.
*/ */
function deleteOldSnapshotZip(object, context) { function deleteOldSnapshotZip(object) {
const bucketId = object.bucket; const bucketId = object.bucket;
const filePath = object.name; const filePath = object.name;
const contentType = object.contentType; const contentType = object.contentType;
const bucket = gcs.bucket(bucketId); const bucket = storage.bucket(bucketId);
const snapshotFolderMatch = filePath.match(snapshotRegex); const snapshotFolderMatch = filePath.match(snapshotRegex);
if (!snapshotFolderMatch || contentType !== 'application/zip') { if (!snapshotFolderMatch || contentType !== 'application/zip') {
return; return;
} }
bucket.getFiles({ bucket.getFiles({
prefix: snapshotFolderMatch[0], prefix: snapshotFolderMatch[0],
delimiter: '/', delimiter: '/',
 End of changes. 6 change blocks. 
5 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)