Skip to content

Commit

Permalink
Merge pull request #401 from jihchi/dependabot/npm_and_yarn/path-to-r…
Browse files Browse the repository at this point in the history
…egexp-8.0.0

Bump path-to-regexp from 7.1.0 to 8.0.0
  • Loading branch information
jihchi authored Sep 7, 2024
2 parents 3785930 + 44639ad commit 81fd890
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"koa-route": "^4.0.1",
"mermaid": "^11.0.2",
"pako": "^2.1.0",
"path-to-regexp": "^7.0.0",
"path-to-regexp": "^8.0.0",
"puppeteer": "^23.0.2"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src/views/services.oembed.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const createDebug = require('debug');
const { pathToRegexp } = require('path-to-regexp');
const { match } = require('path-to-regexp');
const openMermaidPage = require('openMermaidPage');
const renderSVG = require('renderSVG');

const debug = createDebug('app:services:oembed');

const matchImgEncodedCode = match('/img/:encodedCode');

const parseAndValidateURL = (inputURL) => {
let url;

Expand All @@ -27,14 +29,13 @@ const parseAndValidateURL = (inputURL) => {
};

const getEncodedCodeFromURL = ({ pathname }) => {
const regexp = pathToRegexp('/img/:encodedCode');
const matches = regexp.exec(pathname);
const matches = matchImgEncodedCode(pathname);

if (!matches) {
throw new Error('URL pathname supported: /img/:code, /svg/:code');
}

const [, encodedCode] = matches;
const { params: { encodedCode } } = matches;
return encodedCode;
};

Expand Down

0 comments on commit 81fd890

Please sign in to comment.