Skip to content

Commit c0967b3

Browse files
ddlfgMichaelRybak
authored andcommitted
Fix regex in srcset parser. One of the . was not being escaped, and an x was missing.
PiperOrigin-RevId: 334982571
1 parent 4b2d346 commit c0967b3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

transformer/internal/amphtml/srcset.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func roundUp(w int) int {
9191
// [1-9]\d*\.\d+x a decimal with its whole-number part greater
9292
// than zero and followed by an x ...
9393
// | or ...
94-
// 0.\d*[1-9]\d*x a decimal with its fractional part greater
94+
// 0\.\d*[1-9]\d*x a decimal with its fractional part greater
9595
// than zero and followed by an x ...
9696
// )? and make it optional.
9797
// \s* Match, but don't capture space
@@ -107,7 +107,7 @@ var imageCandidateRE = regexp.MustCompile(
107107
`|` +
108108
`[1-9]\d*\.\d+x` +
109109
`|` +
110-
`0.\d*[1-9]\d*` +
110+
`0\.\d*[1-9]\d*x` +
111111
`)?` +
112112
`\s*` +
113113
`(?:(,)\s*)?`)

0 commit comments

Comments
 (0)