@adminforth/markdown 1.11.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build.log CHANGED
@@ -14,5 +14,5 @@ custom/tsconfig.json
14
14
  custom/utils/
15
15
  custom/utils/monacoMarkdownToggle.ts
16
16
 
17
- sent 52,957 bytes received 180 bytes 106,274.00 bytes/sec
17
+ sent 52,947 bytes received 180 bytes 106,254.00 bytes/sec
18
18
  total size is 52,265 speedup is 0.98
package/dist/index.js CHANGED
@@ -158,7 +158,13 @@ export default class MarkdownPlugin extends AdminForthPlugin {
158
158
  }
159
159
  catch (_a) {
160
160
  // Fallback: strip scheme/host if it looks like a URL, otherwise treat as a path.
161
- return stripQueryAndHash(url).replace(/^https?:\/\/[^\/]+\/+/, '').replace(/^\/+/, '');
161
+ const key = stripQueryAndHash(url).replace(/^https?:\/\/[^\/]+\/+/, '').replace(/^\/+/, '');
162
+ // since only local storage adapter returns non-URL paths
163
+ // we need to cut-off express-base
164
+ // e.g. /uploaded-static/cars_description_images-74bbe25a154500c4a2fcb91fb91cea75/sqlite/images_1775114133312.webp
165
+ // should become /sqlite/images_1775114133312.webp
166
+ const cutted = key.split("/").filter(Boolean).slice(2).join("/");
167
+ return cutted;
162
168
  }
163
169
  };
164
170
  const shouldTrackUrl = (url) => {
package/index.ts CHANGED
@@ -170,7 +170,14 @@ export default class MarkdownPlugin extends AdminForthPlugin {
170
170
  return u.pathname.replace(/^\/+/, '');
171
171
  } catch {
172
172
  // Fallback: strip scheme/host if it looks like a URL, otherwise treat as a path.
173
- return stripQueryAndHash(url).replace(/^https?:\/\/[^\/]+\/+/, '').replace(/^\/+/, '');
173
+ const key = stripQueryAndHash(url).replace(/^https?:\/\/[^\/]+\/+/, '').replace(/^\/+/, '');
174
+
175
+ // since only local storage adapter returns non-URL paths
176
+ // we need to cut-off express-base
177
+ // e.g. /uploaded-static/cars_description_images-74bbe25a154500c4a2fcb91fb91cea75/sqlite/images_1775114133312.webp
178
+ // should become /sqlite/images_1775114133312.webp
179
+ const cutted = key.split("/").filter(Boolean).slice(2).join("/");
180
+ return cutted;
174
181
  }
175
182
  };
176
183
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/markdown",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "Markdown plugin for adminforth",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",