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

runtime-fetch: Update amp-geo for subdivision matching #711

Merged
merged 1 commit into from
Apr 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/runtime-fetch/lib/DownloadRuntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,10 @@ class DownloadRuntime {
// If this file is amp-geo.js, then undo the {{AMP_ISO_COUNTRY_HOTPATCH}}
// hotpatch before saving. Otherwise, stream the file directly to disk.
if (/amp-geo-([\d.]+|latest)\.m?js/.test(filepath)) {
const text = (await res.text()).replace(/[a-z]{2} {26}/i, '{{AMP_ISO_COUNTRY_HOTPATCH}}');
const text = (await res.text()).replace(
/[a-z]{2}(?:-[a-z0-9]{2} {23}| {26})/i,
'{{AMP_ISO_COUNTRY_HOTPATCH}}'
);
wstream.write(text, wstream.close.bind(wstream));
} else {
res.body.pipe(wstream);
Expand Down