Attachments path error
Describe your issue
Attachments in pages show a wrong path for open or download. Subdirectory appears twice in url.
Device and settings
WikiDocs-1.0.14
Steps to reproduce
- Upload attachment to a page in wikidocs
- Save
- Attachment is stored in domain.com/wikidocs/datasets/documents/
- Link to attachment shows domain.com/wikidocs/wikidocs/datasets/documents/
- I get Error 404 when clicking
Screenshots (optional)
No response
Extra fields
- [ ] I'd like to work on this issue
In addition, I can´t delete attachments
i think is a problem of the configuration path.. can you paste your config.inc.php ?
config.inc.php
<?php define('DEBUGGABLE',false); define('PATH',"/wikidocs/"); define('LANG',"es"); define('TIMEZONE',"Europe/Madrid"); define('TITLE',"Wiki|Docs"); define('SUBTITLE',"flat-file markdown wiki engine"); define('OWNER',"admin"); define('NOTICE',"admin"); define('PRIVACY',null);
Site is hosted in subdomain
your url is https://domain.com/wikidocs ? or https://subdomain.domain.com/ ?
https://subdomain.domain.com/wikidocs/
ok i will try to fix the bug in this way..
but if you can is better to setup the wiki in https://subdomain.domain.com/ as a workaraound
Hi,
Now when I try to upload pdf file it add path "wiki" 2 times because my wikidocs it's stored on sub-folder https://domain.pt/wiki/
Steps to reproduce
- Edit page
- Select Upload attachment
- Make "save" click outside the pop-pup because click on name file won't work
- Attachment is stored in
https://domain.pt/wiki/wiki/datasets/documents/homepage/temp/t3/evelyn.pdf - When click on page link to open attachment evelyn.pdf shows
https://domain.pt/wiki/wiki/datasets/documents/homepage/temp/t3/evelyn.pdfand I get Error 404 - If i remove one /wiki to
https://domain.pt/wiki/datasets/documents/homepage/temp/t3/evelyn.pdf, work's fine. - When I get Error 404 I need to click on page head name to return to some "work" zone because all tree url name goes to Error 404
can you paste also your actual configuration file?
My config.inc.php file
<?php
define('DEBUGGABLE',false);
define('PATH',"/wiki/");
define('LANG',"en");
define('TIMEZONE',"Europe/Lisbon");
define('TITLE',"P|Docs");
define('SUBTITLE',"markdown wiki engine");
define('OWNER',"Paulo");
define('NOTICE',"Copyright © All rights reserved");
define('PRIVACY',null);
define('EDITCODE',"64b2ce1c532c802e7a96");
define('VIEWCODE',"11d92675885d0");
define('COLOR',"#4CAF50");
define('DARK',false);
define('GTAG',null);
My instalation is on https://domain.pt/wiki/
In my wikidocs tests when i made [link](/) this goes to domain.pt instead domain.pt/wiki.
I don't know if this is related.
Hi,
I try to solve this problem, ... and I don't know if the best way. I will try to explain.
I will use this 2 domains:
- wikidocs on root with domain
http://www1.test/- htaccess:
RewriteBase / - config.inc.php:
define('PATH',"/");
- htaccess:
- wikidocs on sub-folder in folder with domain
http://web-xpto.test/6Ji7bClRFYcnMWE9.Jj6jCrIvLB6KPK26/wikidocs21/- htaccess:
RewriteBase /6Ji7bClRFYcnMWE9.Jj6jCrIvLB6KPK26/wikidocs21/ - config.inc.php:
define('PATH',"/6Ji7bClRFYcnMWE9.Jj6jCrIvLB6KPK26/wikidocs21/");
- htaccess:
After some review I identify LINE 209 on classes/Document.class.php $attachment->url=substr(URL,0,-1).$this->PATH."/".$element_fe; that cause this issue create attachments url http://web-xpto.test/6Ji7bClRFYcnMWE9.Jj6jCrIvLB6KPK26/wikidocs21/6Ji7bClRFYcnMWE9.Jj6jCrIvLB6KPK26/wikidocs21/datasets/documents/ficheiros/pdf.pdf
After some test i identify that substr(URL,0,-1) has this url /6Ji7bClRFYcnMWE9.Jj6jCrIvLB6KPK26/wikidocs21/ and PATH has /6Ji7bClRFYcnMWE9.Jj6jCrIvLB6KPK26/wikidocs21/, if we only add substr(URL,0,-1) or PATH the url stays incomplete http://web-xpto.test/6Ji7bClRFYcnMWE9.Jj6jCrIvLB6KPK26/wikidocs21/6Ji7bClRFYcnMWE9.Jj6jCrIvLB6KPK26/wikidocs21/pdf.pdf won't attach the ID datasets/documents/ like LINE 28 or 29 function says.
To solve the problem I change LINE 209 on classes/Document.class.php from $attachment->url=substr(URL,0,-1).$this->PATH."/".$element_fe; to $attachment->url=PATH."datasets/documents/".$this->ID."/".$element_fe; and it work on 2 cases, wikidocs on root and wikidocs on folder or subfolder.
Please review.
Hi @Zavy86,
Please check my solution https://github.com/Zavy86/WikiDocs/issues/104#issuecomment-2141831767 to wikidocs on subfolder and include on new release.
Thanks