Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fs): asset url calculation #8927

Merged
merged 2 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/frontend/config.cljs
Expand Up @@ -462,7 +462,7 @@
(get-repo-dir (state/get-current-repo)) "assets"))
"/")]
(when (not-empty source)
(string/replace source #"\\.\\./assets/"
(string/replace source #"\.\./assets/"
assets-link-fn))))

(defn get-current-repo-assets-root
Expand Down
4 changes: 2 additions & 2 deletions src/main/frontend/handler/editor.cljs
Expand Up @@ -1451,13 +1451,13 @@

(defn make-asset-url
"Make asset URL for UI element, to fill img.src"
[path] ;; path start with "/assets" or compatible for "../assets"
[path] ;; path start with "/assets"(editor) or compatible for "../assets"(whiteboards)
(if config/publishing?
path
(let [repo (state/get-current-repo)
repo-dir (config/get-repo-dir repo)
;; Hack for path calculation
path (string/replace path #"^(\\.\\.)?/" "./")
path (string/replace path #"^(\.\.)?/" "./")
full-path (path/path-join repo-dir path)
data-url? (string/starts-with? path "data:")]
(cond
Expand Down