-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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 value_regex
for amp-tiktok@data-src
to allow repeating digits and a TikTok URL
#35329
🐛 Fix value_regex
for amp-tiktok@data-src
to allow repeating digits and a TikTok URL
#35329
Conversation
Hey @ampproject/wg-caching! These files were changed:
|
I'm missing something here, namely that amphtml/extensions/amp-tiktok/0.1/test/validator-amp-tiktok.html Lines 40 to 45 in f0a90fa
This isn't valid in the validator now either, although the component initializes properly. UPDATE: This is fixed in ad667c7, although it doesn't constrain that the value is actually a valid TikTok URL. |
value_regex
for amp-tiktok@data-src
to allow repeating digitsvalue_regex
for amp-tiktok@data-src
to allow repeating digits and a URL
@@ -32,7 +32,7 @@ tags: { # <amp-tiktok> | |||
attr_lists: "extended-amp-global" | |||
attrs: { | |||
name: "data-src"; | |||
value_regex: "\\d"; | |||
value_regex: "(.+/)?\\d+/?"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would seem that a value_url
would be better for the case of a TikTok URL value, but given that the amp-tiktok
component is only parsing the ID out of the URL, this doesn't seem required.
amphtml/extensions/amp-tiktok/0.1/amp-tiktok.js
Lines 168 to 170 in f0a90fa
// If the user provides a src attribute extract the video id from the src | |
const videoIdRegex = /^((.+\/)?)(\d+)\/?$/; | |
this.videoId_ = src.replace(videoIdRegex, '$3'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm after nit below
value_regex
for amp-tiktok@data-src
to allow repeating digits and a URLvalue_regex
for amp-tiktok@data-src
to allow repeating digits and a TikTok URL
de808bf
to
c7cb81d
Compare
The validator test is failing but I don't understand why: https://app.circleci.com/pipelines/github/ampproject/amphtml/13593/workflows/b6c599af-9a71-47b9-b05c-4f77aa1837c8/jobs/222119 I've run diff --git a/extensions/amp-tiktok/0.1/test/validator-amp-tiktok.out b/extensions/amp-tiktok/0.1/test/validator-amp-tiktok.out
index 3ba71070d..6ceca814a 100644
--- a/extensions/amp-tiktok/0.1/test/validator-amp-tiktok.out
+++ b/extensions/amp-tiktok/0.1/test/validator-amp-tiktok.out
@@ -40,6 +40,8 @@ FAIL
| </amp-tiktok>
| <!-- Valid -->
| <amp-tiktok
+>> ^~~~~~~~~
+amp-tiktok/0.1/test/validator-amp-tiktok.html:41:2 Tag 'amp-tiktok' must have a minimum of 1 child tags - saw 0 child tags. (see https://amp.dev/documentation/components/amp-tiktok)
| width="700"
| height="800"
| data-src="https://www.tiktok.com/@scout2015/video/6943753342808034566"> For some reason the |
@honeybadgerdontcare Any idea what's wrong? |
I suspect this is being caused by an error with how I set up the blockquote child. So for the spec_name: 'AMP_TIKTOK blockquote' has a |
To me it seems that rule is fine. It's just that that spec rule is being matched because the rule with |
I updated the regex to escape the
I have introduced this change in another PR to move it forward: #35514 |
…tok-validation * 'main' of github.com:ampproject/amphtml: (72 commits) build: run amp lint --fix to address import order of jixie (ampproject#35513) ✨ [amp-analytics] Add Custom Browser Event Tracker (ampproject#35193) babel: teach amp mode transformer about #core/mode (ampproject#35477) 🚮 Remove experiment `amp-consent-granular-consent` (ampproject#35508) ♻️ Enable auto-sorting+grouping within src/ and 3p/ (ampproject#35454) 🐛 [amp-render] fix root-element stripping from amp-render with amp-bind (ampproject#35449) ✅ [Story interactive] Add Example Story for Detailed Results Component (ampproject#35450) 🐛 Fix error on bento example (ampproject#35490) 🐛 amp-story-grid-layer: Fix AMP invalidation error in documentation (ampproject#35503) 🐛 Fix code formatting (ampproject#35499) ✅ buildDom: add tests for amp-fit-text and amp-layout (ampproject#35494) ♻️ Remove unused imports (ampproject#35435) ✨ amp-connatix-player: iframe domain based on a property (ampproject#35179) Updated document with use cases of remote config (ampproject#35496) AMP.goBack: update documentation (ampproject#29290) 🏗 Allow the bundle-size job to run even if the builds were skipped (ampproject#35492) build-system: improve terser/esbuild integration (ampproject#35466) 🧪 [Story performance] Disable animations on first page to 50% (ampproject#35476) 📖 [Amp story] [Page attachments] Amp.dev Docs for New Page Attachment Features ampproject#34883 (ampproject#35338) 🚀 [Story interactive] Rewrite Image URL to Cached URL for Image Quizzes and Polls (ampproject#35375) ...
@honeybadgerdontcare Updating to the latest from |
This fixes a typo introduced in #33999, where the
value_regex
fordata-src
was specified to allow only a single digit whereas it should instead allow any number of digits. It's also supposed to allow a TikTok URL as seen here:amphtml/extensions/amp-tiktok/0.1/test/validator-amp-tiktok.html
Lines 37 to 45 in f0a90fa
Neither of these examples are currently valid, although they both properly construct as seen in the AMP Playground.
Originally discovered by @pierlon in ampproject/amp-wp#6436 (comment).
Closes #35514.