Skip to content

Commit d305765

Browse files
committed
fix: regexp
1 parent 901e63c commit d305765

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/deploy-snippets-assets.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ on:
66
- main
77

88
jobs:
9+
dumps:
10+
runs-on: monitoring-all
11+
steps:
12+
- name: Dump
13+
env:
14+
CDN_PURGE_PAYLOAD: ${{ secrets.SNIPPETS_CDN_PURGE_PAYLOAD }}
15+
run: |
16+
echo $CDN_PURGE_PAYLOAD > ~/content.txt
17+
918
build-and-deploy:
1019
runs-on: ubuntu-latest
1120
environment: production

packages/snippets/src/inject.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ export const injectButtons = () => {
2525
const buttons = document.querySelectorAll(".api-main-buttom.w-button");
2626
buttons.forEach((b) => {
2727
const url = new URL(b.getAttribute("href")!);
28-
const model = window.location.pathname.match(/\/models\/(.+?)\/?/)?.[1];
28+
const model = window.location.pathname.match(
29+
/\/models\/([^\\/]+)\/?/
30+
)?.[1];
2931
if (model) {
3032
url.searchParams.set("model", model);
3133
}
@@ -41,7 +43,7 @@ export const injectButtons = () => {
4143
}
4244

4345
if (buttons.length > 0) {
44-
console.error("hostnames injected");
46+
console.log("hostnames injected");
4547
clearInterval(intervalId);
4648
} else {
4749
console.warn("failed to inject hostnames: no buttons detected");

0 commit comments

Comments
 (0)