Skip to content

Commit

Permalink
Exclude equals symbols from URL regex
Browse files Browse the repository at this point in the history
  • Loading branch information
vrugtehagel committed Jun 20, 2024
1 parent 4a1867b commit feb8bce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vrugtehagel/eleventy-asset-hash",
"version": "0.1.4",
"version": "0.1.5",
"exports": "./mod.ts",
"publish": {
"include": ["src/**", "mod.ts", "README.md"]
Expand Down
8 changes: 4 additions & 4 deletions src/detect-assets.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/** Valid URL path characters are [!$%(-;=@-[\]_a-z~].
/** Valid URL path characters are [!$%(-;@-[\]_a-z~].
* The entire regex matches assets in a string of content.
* This does not match URLs including a domain, by design. */
const regex = new RegExp(
"(?<=[^!$%(-;=@-[\\]_a-z~])" + // must be preceded by non-URL character
"(?<=[^!$%(-;@-[\\]_a-z~])" + // must be preceded by non-URL character
"\\.{0,2}/" + // then zero to two periods and a slash
"[!$%(-;=@-[\\]_a-z~]*" + // any number of URL characters
"[!$%(-;@-[\\]_a-z~]*" + // any number of URL characters
"\\.\\w+" + // the file extension, minimum one character long
"(?=[^!$%(-;=@-[\\]_a-z~])", // followed by a non-URL character
"(?=[^!$%(-;@-[\\]_a-z~])", // followed by a non-URL character
"g", // This is not part of the regex, it's just a flag
);

Expand Down

0 comments on commit feb8bce

Please sign in to comment.