- Issue created by @wim leers
- π¬π§United Kingdom f.mazeikis Brighton
Wim Leers β credited f.mazeikis β .
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Turns out that Felix spotted this same problem back on May 24, but only told me in a DM π
Felix Mazeikis 10:23 Good morning :wave: 10:24 Remember me complaining about URI validation failing on relative paths for images? I think Iβve figured out the cause 10:25 In our schema.json https://git.drupalcode.org/project/experience_builder/-/blob/0.x/schema.json?ref_type=heads#L23 and in the SDC 'sdc_test:my-cta' that is owned by sdc_test in core https://git.drupalcode.org/project/drupal/-/blob/10.2.x/core/modules/sdc/tests/modules/sdc_test/components/my-cta/my-cta.component.yml#L19 we use format: uri constraint 10:26 That constraint get picked up by jsonrainbow/json-schema validator and hits this https://github.com/jsonrainbow/json-schema/blob/master 10:27 And while the format is for uri, the constraint uses FILTER_VALIDATE_URL php filter constant - https://www.php.net/manual/en/filter.filters.validate.php constraint uses FILTER_VALIDATE_URL php filter constant - https://www.php.net/manual/en/filter.filters.validate.php 10:28 php.net has this to say about the FILTER_VALIDATE_URL Validates value as URL (according to Β» http://www.faqs.org/rfcs/rfc2396), optionally with required components. Beware a valid URL may not specify the HTTP protocol http:// so further validation may be required to determine the URL uses an expected protocol, e.g. ssh:// or mailto:. Note that the function will only find ASCII URLs to be valid; internationalized domain names (containing non-ASCII characters) will fail. faqs.orgfaqs.org RFC 2396 - Uniform Resource Identifiers (URI): Generic Syntax (RFC2396) RFC 2396 - Uniform Resource Identifiers (URI): Generic Syntax 10:28 I think this function does not acknowledge relative paths as correct URLs 10:32 Thereβs a issue thread discussing adjacent issue, where someone was using this to validate URNs and it also fails https://github.com/jsonrainbow/json-schema/issues/685 10:33 We might want to pitch in, as I imagine thereβs weβre going to use something akin to format: uri a lot :thinking_face:
- Merge request !142Resolve #3466042 "Todo json schema string format uri" β (Merged) created by wim leers
- Assigned to f.mazeikis
- Status changed to Needs review
3 months ago 4:25pm 5 August 2024 - Status changed to RTBC
3 months ago 8:39am 7 August 2024 - π¬π§United Kingdom f.mazeikis Brighton
Approved - thatβs a really neat solution until upstream changes happens
-
Wim Leers β
committed fb31e7be on 0.x
Issue #3466042 by Wim Leers, f.mazeikis: Follow-up for #3461499: figure...
-
Wim Leers β
committed fb31e7be on 0.x
- Issue was unassigned.
- Status changed to Fixed
3 months ago 9:38am 7 August 2024 Automatically closed - issue fixed for 2 weeks with no activity.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
This was only a partial solution. Complete solution: π `{type: string, format: uri}` disallows image URLs containing spaces, `uri` data type stores + returns invalid URIs! Fixed .