• Resolved iworldc

    (@iworldc)


    Hello,

    I have several issues, that makes this plugin worthless. I use the Jarida theme. I cannot switch it or disable other plugins, because the site is a live site.

    Problems with this plugin:

    • When I enter a path to a file outside the web root (to prevent direct access), I cannot download it.
    • When I enter a path to a file inside the web root (somewhere in the wordpress uploads directory), I CAN download the file, but it’s always ZERO bytes.
    • When I click to upload a file, the file is uploaded indeed, but when I click insert, the field where the path to the file should appear remains empty.

    Regards,
    Maurice

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter iworldc

    (@iworldc)

    Okay, I decided to dive into the code myself.

    In file sdm-download-request-handler.php WHY are you using:

    ob_end_clean();

    When you change that to:

    ob_clean();
    flush();

    You have solved problem 2, the zero byte downloads.

    I will see if I can find solutions to the other issues (1 and 3)

    Thread Starter iworldc

    (@iworldc)

    Problem 1 has been solved too. In the same file there is some stupid code:

    if ( $dispatch && (stripos($download_link, WP_CONTENT_URL) === 0) )

    WHY check if the string ‘https://domainname/wp_content’ exists in the file path? Is this your way to check if a file is local? That’s why local files with a PATH, like files out of your web root, are not accepted either.

    For now, I’ve changed that line into:

    if ( $dispatch )

    I also changed this:
    $file = path_join(WP_CONTENT_DIR, ltrim(substr($download_link, strlen(WP_CONTENT_URL)), '/'));

    into this:

    $file = $download_link;

    Now I can enter a path to a file that’s outside of my web root and download it when I click the Download Now button. Now the download files don’t have to reside in a publicly accessible folder.

    So with this, issue 1 has been solved too.

    • This reply was modified 8 years, 1 month ago by iworldc.
    • This reply was modified 8 years, 1 month ago by iworldc.
    Plugin Contributor mbrsolution

    (@mbrsolution)

    Hi Maurice, that looks good. I am happy you solved a few issues. The plugin developers will investigate further your solutions and issues.

    Kind regards

    Plugin Author mra13

    (@mra13)

    I have replied to your following review. I will not be giving anymore reply to you and waste my time.

    https://www.ads-software.com/support/topic/worthless-4/

    • This reply was modified 8 years, 1 month ago by mra13.

    Hi Maurice,

    Since I wrote this stupid code, I feel obliged to chime in.

    When I enter a path to a file outside the web root (to prevent direct access), I cannot download it.

    That’s expected behavior, the plugin supports neither using file path nor dispatching files from outside of the WordPress content directory.

    The reason for not supporting file path is mainly historical – dispatch feature is relatively new and before it has been added, you had to use file URL even for local downloads. Since the edit screen UI doesn’t support inclusion of file path, neither does the dispatch routine.

    The reason for limiting dispatch to files in content directory is a matter of basic security. Would you like your authors to be able to create download link to your wp-config.php? Maybe you are the only user of your website, so you don’t care, but you’re not the only user of this plugin.

    Anyway, your use case is legitimate and it would be relatively easy to add support for custom folders to the plugin. It’s a pity you just haven’t asked for it – I could have implement it instead of replying to your lament ??

    When I enter a path to a file inside the web root (somewhere in the wordpress uploads directory), I CAN download the file, but it’s always ZERO bytes.

    Maybe you could give us more details on your webserver setup or why flushing the output buffer before actually outputting file contents is necessary in your case? It really interests me, because I don’t see why your change should fix anything, but I cannot replicate your problem without more information.

    The ob_end_clean function clears the output buffer and stops output buffering. Clearing is done just in case to avoid any empty lines etc. output by accident before the dispatch routine runs to be prepended to contents of download file. Stopping output buffering is necessary to avoid memory issues, when large files are dispatched.

    When I click to upload a file, the file is uploaded indeed, but when I click insert, the field where the path to the file should appear remains empty.

    This is a bit confusing and the UI would benefit from some improvements here: you have to fill in “Link URL” field first, otherwise nothing is inserted. In other words, first click on “File URL” button (you want to link to the file URL), then on “Insert into Post”.

    Cheers,
    ?eslav

    To your point on problem three, the UI says that you can upload a file and the URL will be populated. I’m having the same issue as this user. If you watch the instructional video on the homepage he even shows that you click upload file, insert into post, then the url field is populated.

    Plugin Author mra13

    (@mra13)

    Before you hit the “insert” button, can you please make sure that you have the file URL in there? Can you see the full static file URL in the “Link URL” file of the upload dialogue box? There is a button there that says “File URL” which you can click to make sure that field contains the file URL.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Multiple problems’ is closed to new replies.