Skip to content

Commit 48e1005

Browse files
committed
merged pull request org-roam#312 to fix issue org-roam#236
1 parent 5ac7496 commit 48e1005

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

org-roam-ui.el

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ Format as, i.e. with double backslashes for a single backslash:
153153
:type 'alist)
154154

155155
;; Internal vars
156+
(defvar org-roam-ui--roam-directory nil
157+
"Var to keep track of the current org-roam-directory, used in servlet")
156158

157159
(defvar org-roam-ui--ws-current-node nil
158160
"Var to keep track of which node you are looking at.")
@@ -182,6 +184,7 @@ This serves the web-build and API over HTTP."
182184
;;; else add them
183185
(setq-local httpd-port org-roam-ui-port)
184186
(setq httpd-root org-roam-ui-app-build-dir)
187+
(setq org-roam-ui--roam-directory org-roam-directory)
185188
(httpd-start)
186189
(setq org-roam-ui-ws-server
187190
(websocket-server
@@ -300,11 +303,13 @@ TODO: Be able to delete individual nodes."
300303

301304
(defservlet* node/:id text/plain ()
302305
"Servlet for accessing node content."
306+
(setq org-roam-directory org-roam-ui--roam-directory)
303307
(insert (org-roam-ui--get-text (org-link-decode id)))
304308
(httpd-send-header t "text/plain" 200 :Access-Control-Allow-Origin "*"))
305309

306310
(defservlet* img/:file text/plain ()
307311
"Servlet for accessing images found in org-roam files."
312+
(setq org-roam-directory org-roam-ui--roam-directory)
308313
(progn
309314
(httpd-send-file t (org-link-decode file))
310315
(httpd-send-header t "text/plain" 200 :Access-Control-Allow-Origin "*")))

0 commit comments

Comments
 (0)