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

If WordPress isn't installed at webroot export download doesn't work #4

Open
aoloe opened this issue Jan 12, 2018 · 5 comments
Open
Assignees

Comments

@aoloe
Copy link

aoloe commented Jan 12, 2018

if wordpress is not installed at the root of the server, the export link does not respect the custon url.

in my case, the wordpress directory is not even at the root of the wordpress site...

@k1sul1 k1sul1 changed the title does not respect custom urls If WordPress isn't installed at webroot the plugin is broken Jan 12, 2018
@k1sul1 k1sul1 changed the title If WordPress isn't installed at webroot the plugin is broken If WordPress isn't installed at webroot export download doesn't work Jan 12, 2018
@k1sul1
Copy link
Member

k1sul1 commented Jan 12, 2018

Interesting.

The link that is shown on the notice indeed points to the root folder, even if your site doesn't exist there.
The handleDownload function also checks that the URL has /wplf-export as a guard, which is a bit problematic if your site resides on example.com/wordpress.

You should still be able to download the file and delete it manually.

Sorry for the inconvenience. This can be fixed in a few ways, the first idea I got was switching to query params completely, like checking $_GET['action'] === 'wplf-export' instead of parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH) === '/wplf-export').

I'm very busy in the coming weeks, so I don't have the time for fixing this and testing througly.

k1sul1 added a commit that referenced this issue Jan 12, 2018
@k1sul1
Copy link
Member

k1sul1 commented Jan 12, 2018

@aoloe Does this work for you? https://github.com/libreform/export/archive/allow-nonwebroot.zip

No guarantees that it works, but it just might.

@aoloe
Copy link
Author

aoloe commented Jan 12, 2018

it works better.

but now i get a popup instead of the csv to be downloaded...

the content is:

"""
Are you sure you want to do this?
"""

the url of the popup is:

http://www.mysite.org/2018/wp/wp-admin/edit.php?action=wplf-export&wplf-export-download=%2Fhome%2Fmyuser%2Fhttpdocs%2Fwww.mysite.org%2Fhttpdocs%2F2018%2Fwp%2Fwp-content%2Fuploads%2Fwplf%2Fwplf_export_1515771766.csv

@k1sul1
Copy link
Member

k1sul1 commented Jan 12, 2018

By popup, you mean the WordPress error screen? If it's a JavaScript confirm prompt it's coming from somewhere else.

I'm going with the assumption that it's the WordPress error screen. By the looks of the URL, it may be that WP doesn't like the action parameter on edit.php, but this is just a guess. By using get_site_url() in front of the URL, it should (probably) work.

5e8f54d

You can do that by editing these lines. I can't make a patch right now, but if you try this and it works, feel free to submit a pull request :)

@aoloe
Copy link
Author

aoloe commented Jan 16, 2018

using get_site_url() in the notices hrefs does indeed solve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants