Skip to content

Commit c61508e

Browse files
Merge pull request #152 from angular/master
Update upstream
2 parents c819488 + d7d64cc commit c61508e

File tree

4 files changed

+3756
-15
lines changed

4 files changed

+3756
-15
lines changed

docs/content/misc/downloading.ngdoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
@description
44

55
# Including AngularJS scripts from the Google CDN
6-
The quickest way to get started is to point your html `<script>` tag to a
7-
[Google CDN](https://developers.google.com/speed/libraries/#angularjs) URL.
6+
The quickest way to get started is to point your html `<script>` tag to a Google CDN URL.
87
This way, you don't have to download anything or maintain a local copy.
98

109
There are two types of AngularJS script URLs you can point to, one for development and one for

scripts/code.angularjs.org-firebase/functions/index.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ const BROWSER_CACHE_DURATION = 60 * 10;
1010
const CDN_CACHE_DURATION = 60 * 60 * 12;
1111

1212
function sendStoredFile(request, response) {
13-
let filePathSegments = request.path.split('/').filter((segment) => {
13+
const requestPath = request.path || '/';
14+
let filePathSegments = requestPath.split('/').filter((segment) => {
1415
// Remove empty leading or trailing path parts
1516
return segment !== '';
1617
});
@@ -159,7 +160,11 @@ function sendStoredFile(request, response) {
159160
const nextQuery = data[1];
160161
const apiResponse = data[2];
161162

162-
if (!files.length && (!apiResponse || !apiResponse.prefixes)) {
163+
if (
164+
// we got no files or directories from previous query pages
165+
!fileList.length && !directoryList.length &&
166+
// this query page has no file or directories
167+
!files.length && (!apiResponse || !apiResponse.prefixes)) {
163168
return Promise.reject({
164169
code: 404
165170
});
@@ -190,22 +195,16 @@ const snapshotRegex = /^snapshot(-stable)?\//;
190195
* When a new zip file is uploaded into snapshot or snapshot-stable,
191196
* delete the previous zip file.
192197
*/
193-
function deleteOldSnapshotZip(event) {
194-
const object = event.data;
195-
198+
function deleteOldSnapshotZip(object, context) {
196199
const bucketId = object.bucket;
197200
const filePath = object.name;
198201
const contentType = object.contentType;
199-
const resourceState = object.resourceState;
200202

201203
const bucket = gcs.bucket(bucketId);
202204

203205
const snapshotFolderMatch = filePath.match(snapshotRegex);
204206

205-
if (!snapshotFolderMatch ||
206-
contentType !== 'application/zip' ||
207-
resourceState === 'not_exists' // Deletion event
208-
) {
207+
if (!snapshotFolderMatch || contentType !== 'application/zip') {
209208
return;
210209
}
211210

@@ -230,4 +229,4 @@ function deleteOldSnapshotZip(event) {
230229
}
231230

232231
exports.sendStoredFile = functions.https.onRequest(sendStoredFile);
233-
exports.deleteOldSnapshotZip = functions.storage.object().onChange(deleteOldSnapshotZip);
232+
exports.deleteOldSnapshotZip = functions.storage.object().onFinalize(deleteOldSnapshotZip);

0 commit comments

Comments
 (0)