Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reloading for 'latest' extension versions #25763

Merged

Conversation

dreamofabear
Copy link

Fixes #25751.

const regex = /^(.*)\/(.*)-([0-9.]+)\.js$/i;
const matches = scriptUrl.match(regex);

const matches = scriptUrl.match(/^(.*)\/(.*)-([0-9.]+|latest)\.js$/i);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We can drop the ^(.*)\/ entirely

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we at least need the \/ to separate the extension ID? E.g. https://cdn.ampproject.org/v0/amp-foo-latest.js.

@dreamofabear dreamofabear merged commit 6730e61 into ampproject:master Nov 25, 2019
@dreamofabear dreamofabear deleted the reload-latest-extension branch November 25, 2019 23:04
const matches = this.win.document.head./*OK*/ querySelectorAll(
`script[src*="/${extensionId}-"]` + modifier
);
const matcher = new RegExp(`${extensionId}-\\d`);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gmajoulet This used to match local builds like amp-foo-0.1.max.js, but parseExtensionUrl does not. Need to update it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#25862 should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AMP page is breaking when browser cached files are loading
3 participants