This repository was archived by the owner on Apr 12, 2024. It is now read-only.
chore(*): fix serving of URI-encoded files on code.angularjs.org #16943
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The files served for the various versions on https://code.angularjs.org/ are retrieved by a Firebase function from a Firebase Storage bucket (where they are deployed to from Travis CI). The files are stored exactly as they are named on disk.
It turns out that some of the files have names with special characters that get URI-encoded when sent to the Firebase function. For example,
input[text].html
becomesinput%5Btext%5D.html
. As a result, the actual file cannot be retrieved from the Storage bucket (since the name does not match) andindex.html
is returned instead. Apparently, this never worked, but nobody noticed or reported it until recently.An example of a failing URL is: https://code.angularjs.org/1.7.9/docs/api/ng/input/input%5Btext%5D
(NOTE: https://docs.angularjs.org/ works correctly, since the files are deployed to Firebase hosting directly and not to a Storage bucket.)
This commit fixes the problem by decoding the request path before trying to retrieve the corresponding file from the Storage bucket.