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

Attachments path error #104

Open
1 task
lbarriocanal opened this issue Feb 6, 2024 · 12 comments
Open
1 task

Attachments path error #104

lbarriocanal opened this issue Feb 6, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@lbarriocanal
Copy link

lbarriocanal commented Feb 6, 2024

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

  1. Upload attachment to a page in wikidocs
  2. Save
  3. Attachment is stored in domain.com/wikidocs/datasets/documents/
  4. Link to attachment shows domain.com/wikidocs/wikidocs/datasets/documents/
  5. I get Error 404 when clicking

Screenshots (optional)

No response

Extra fields

  • I'd like to work on this issue
@lbarriocanal lbarriocanal added the bug Something isn't working label Feb 6, 2024
@lbarriocanal
Copy link
Author

In addition, I can´t delete attachments

@Zavy86
Copy link
Owner

Zavy86 commented Feb 7, 2024

i think is a problem of the configuration path.. can you paste your config.inc.php ?

@lbarriocanal
Copy link
Author

lbarriocanal commented Feb 7, 2024

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

@Zavy86
Copy link
Owner

Zavy86 commented Feb 7, 2024

@lbarriocanal
Copy link
Author

@Zavy86
Copy link
Owner

Zavy86 commented Feb 7, 2024

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

@ffiesta
Copy link
Contributor

ffiesta commented Feb 26, 2024

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

  1. Edit page
  2. Select Upload attachment
  3. Make "save" click outside the pop-pup because click on name file won't work
  4. Attachment is stored in https://domain.pt/wiki/wiki/datasets/documents/homepage/temp/t3/evelyn.pdf
  5. When click on page link to open attachment evelyn.pdf shows https://domain.pt/wiki/wiki/datasets/documents/homepage/temp/t3/evelyn.pdf and I get Error 404
  6. If i remove one /wiki to https://domain.pt/wiki/datasets/documents/homepage/temp/t3/evelyn.pdf, work's fine.
  7. 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

@Zavy86
Copy link
Owner

Zavy86 commented Feb 28, 2024

can you paste also your actual configuration file?

@ffiesta
Copy link
Contributor

ffiesta commented Feb 28, 2024

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/

@ffiesta
Copy link
Contributor

ffiesta commented Feb 28, 2024

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.

@ffiesta
Copy link
Contributor

ffiesta commented May 31, 2024

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:

  1. wikidocs on root with domain http://www1.test/
    • htaccess:RewriteBase /
    • config.inc.php: define('PATH',"/");
  2. 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/");

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.

@ffiesta
Copy link
Contributor

ffiesta commented Jun 8, 2024

Hi @Zavy86,

Please check my solution #104 (comment) to wikidocs on subfolder and include on new release.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants