DRAW.IO Images saved in wrong location #3333

Closed
opened 2026-02-05 06:23:06 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @Hiajen on GitHub (Nov 8, 2022).

Describe the Bug

Just tried to include a draw io image via the build in integration.
After saving the diagram only a "no file found" icon would be displayed.

After some digging i found the image in the storage folder. But the file reference was under the "public" folder.

A manually created softlink in the public folder solved my problem but thats more a hack then a fix.

Thanks in advance.

Steps to Reproduce

  1. have a running instace
  2. create document
  3. click on "insert drawing"
  4. create diagram
  5. save diagram
  6. look at outcome

Expected Behaviour

After saving an diagram via the draw io integration, it is displayed correctly

Screenshots or Additional Context

No response

Browser Details

Firefox 106.0.3 (64-bit)

Exact BookStack Version

v22.10.2

PHP Version

8.0

Hosting Environment

Debian 11 - Manual instalation - NginX - Redis

Originally created by @Hiajen on GitHub (Nov 8, 2022). ### Describe the Bug Just tried to include a draw io image via the build in integration. After saving the diagram only a "no file found" icon would be displayed. After some digging i found the image in the storage folder. But the file reference was under the "public" folder. A manually created softlink in the public folder solved my problem but thats more a hack then a fix. Thanks in advance. ### Steps to Reproduce 1. have a running instace 2. create document 3. click on "insert drawing" 4. create diagram 5. save diagram 6. look at outcome ### Expected Behaviour After saving an diagram via the draw io integration, it is displayed correctly ### Screenshots or Additional Context _No response_ ### Browser Details Firefox 106.0.3 (64-bit) ### Exact BookStack Version v22.10.2 ### PHP Version 8.0 ### Hosting Environment Debian 11 - Manual instalation - NginX - Redis
OVERLORD added the 🐛 Bug label 2026-02-05 06:23:06 +03:00
Author
Owner

@Hiajen commented on GitHub (Nov 8, 2022):

Demo Instance seems to not have this issue, maybe a config issue.

@Hiajen commented on GitHub (Nov 8, 2022): Demo Instance seems to not have this issue, maybe a config issue.
Author
Owner

@ssddanbrown commented on GitHub (Nov 8, 2022):

Hi @Hiajen,
Can you confirm the value of any STORAGE related options in your .env file?
In addition, would you be able to explain exactly what was observed to make the following statement:

But the file reference was under the "public" folder.

Just want to understand exactly what you're seeing in relation to the public folder and paths.

@ssddanbrown commented on GitHub (Nov 8, 2022): Hi @Hiajen, Can you confirm the value of any `STORAGE` related options in your `.env` file? In addition, would you be able to explain exactly what was observed to make the following statement: > But the file reference was under the "public" folder. Just want to understand exactly what you're seeing in relation to the public folder and paths.
Author
Owner

@Hiajen commented on GitHub (Nov 8, 2022):

hay @ssddanbrown thanks for the quick response!

only storage related value set is STORAGE_TYPE=local_secure

to be honest, it was a bold assumption and i tried the softlink fix.
I observed a console error in my browser stating 404 no image found. Then i looked at the url (<domain>/uploads/images/drawio/2022-11/<name>.png) and searched for matching paths in the bookstack directory. Found storage/uploads/images/drawio/<etc> and public/uploads/images/*.

public folder containing a "user" folder only.

the statement is only based on this observation, found no logs errors expect the browser 404

@Hiajen commented on GitHub (Nov 8, 2022): hay @ssddanbrown thanks for the quick response! only storage related value set is `STORAGE_TYPE=local_secure` to be honest, it was a bold assumption and i tried the softlink fix. I observed a console error in my browser stating 404 no image found. Then i looked at the url (`<domain>/uploads/images/drawio/2022-11/<name>.png`) and searched for matching paths in the bookstack directory. Found `storage/uploads/images/drawio/<etc>` and `public/uploads/images/*`. public folder containing a "user" folder only. the statement is only based on this observation, found no logs errors expect the browser 404
Author
Owner

@Hiajen commented on GitHub (Nov 8, 2022):

reading the documentation by linking the storage folder to the public folder i made the contents publicly available ... so thats not a good solution but "fixes" the 404 issue.

@Hiajen commented on GitHub (Nov 8, 2022): reading the documentation by linking the storage folder to the public folder i made the contents publicly available ... so thats not a good solution but "fixes" the 404 issue.
Author
Owner

@ssddanbrown commented on GitHub (Nov 9, 2022):

@Hiajen Yeah, you're essentially working around the whole local_secure system by linking.

  • Does this only occur for drawings or does the same occur for normal images uploaded to pages?
  • For normal page images, can you see the thumbnails in the image gallery grid?

Since you have a manual install on the go, Would be handy if you could share your nginx config to get some insight into the setup there.

@ssddanbrown commented on GitHub (Nov 9, 2022): @Hiajen Yeah, you're essentially working around the whole `local_secure` system by linking. - Does this only occur for drawings or does the same occur for normal images uploaded to pages? - For normal page images, can you see the thumbnails in the image gallery grid? Since you have a manual install on the go, Would be handy if you could share your nginx config to get some insight into the setup there.
Author
Owner

@Hiajen commented on GitHub (Nov 9, 2022):

sure @ssddanbrown

  • same for images and attached images, same for public docs as well as restricted docs
  • i am sorry, don't know what the gallery grid is

sure thing!

server {
	listen 443 ssl http2;
	listen [::]:443 ssl http2;
	server_name <domain>;

	# Own Configs
	include /etc/nginx/snippets/ssl.conf;
	include /etc/nginx/snippets/headers.conf;

	# Disable error and access log.
	# This way, no IP will be logged by nginx
	access_log off;
	error_log off;

	root /var/www/BookStack/public;

	index index.php index.html;

	# set max upload size
	client_max_body_size 512M;
	fastcgi_buffers 64 4K;

	location / {
		try_files $uri $uri/ /index.php?$query_string;
	}

	location ~ \.php$ {
		try_files $uri =404;
		fastcgi_pass php-handler;
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		include fastcgi_params;
	}

	location /uploads {
		autoindex off;
	}
}

(all images are uploaded correctly and stored in the storage dir)

Thanks a lot for your help!

@Hiajen commented on GitHub (Nov 9, 2022): sure @ssddanbrown - same for images and attached images, same for public docs as well as restricted docs - i am sorry, don't know what the gallery grid is sure thing! ``` server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name <domain>; # Own Configs include /etc/nginx/snippets/ssl.conf; include /etc/nginx/snippets/headers.conf; # Disable error and access log. # This way, no IP will be logged by nginx access_log off; error_log off; root /var/www/BookStack/public; index index.php index.html; # set max upload size client_max_body_size 512M; fastcgi_buffers 64 4K; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { try_files $uri =404; fastcgi_pass php-handler; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location /uploads { autoindex off; } } ``` (all images are uploaded correctly and stored in the storage dir) Thanks a lot for your help!
Author
Owner

@ssddanbrown commented on GitHub (Nov 9, 2022):

@Hiajen Thanks for the further info.

Once thing I noticed in your config is the fastcgi_split_path_info does not align with what I commonly see.
This could potentially be affecting things, I commonly see fastcgi_split_path_info ^(.+?\.php)(/.*)$;
Typically on debian-based nginx setups i tend to just include the snippets/fastcgi-php.conf file (Relative to /etc/nginx).

This might not be the issue but worth a try since the issue sounds like some kind of potential pathing mis-match.

@ssddanbrown commented on GitHub (Nov 9, 2022): @Hiajen Thanks for the further info. Once thing I noticed in your config is the `fastcgi_split_path_info` does not align with what I commonly see. This could potentially be affecting things, I commonly see `fastcgi_split_path_info ^(.+?\.php)(/.*)$;` Typically on debian-based nginx setups i tend to just include the `snippets/fastcgi-php.conf` file (Relative to `/etc/nginx`). This might not be the issue but worth a try since the issue sounds like some kind of potential pathing mis-match.
Author
Owner

@Hiajen commented on GitHub (Nov 9, 2022):

thanks for the tipp @ssddanbrown . Problem was the autoindex off; statement ...
without it, everything works.

Sorry for the inconvenience! And thanks for the help!

@Hiajen commented on GitHub (Nov 9, 2022): thanks for the tipp @ssddanbrown . Problem was the `autoindex off;` statement ... without it, everything works. Sorry for the inconvenience! And thanks for the help!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3333