AmazonS3 and Restricted Downloads error

Hello,

I searched and seen that others have had this issue, but have not seen a resolution.

I am trying to set up the restricted download process and have followed along with the video in the documentation.

I get to the point of creating the download link and I continue to get the error:

SignatureDoesNotMatch

This is in the browser that states “This XML file does not appear to have any style information associated with it. The document tree is shown below.” with a bunch of other jargon.

Anyways, when I click on the link, it appears to take me to the right location of the file, but appends a bunch of additional information such as:

FILENAME?X-Amz-Algorithm=XXXXXXXXX-Amz-Credential=XXXXXXXXXus-east-1XXXXXXXXXaws4_request&X-Amz-Date=20180829T184500Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&response-cache-control=no-cache%2C+must-revalidate%2C+max-age%3D0%2C+post-check%3D0%2C+pre-check%3D0&response-content-disposition=attachment%3B+filename%3D%2201.1+Algebra+Concept+Overview.pdf%22&response-content-type=application%2Fpdf&response-expires=Wed%2C+22+Aug+2018+18%3A45%3A00+GMT&X-Amz-Signature=XXXXXXXXX

I replaced some of the digits with XXXXXXXXX obviously, not sure if it’s supposed to stay private.

Anyways, when I take all of that off and reload the page, the file displays, here is an example:

https://prepineer_uploads.s3.amazonaws.com/001+Mathematics/01.1+Algebra+Concept+Overview.pdf

Can anyone give me some direction on what to do here, thank you.

Justin

Alright, still troubleshoot here, but was able to get the download to work when I linked to a file with no spaces inside the root folder, for example:

< a href="/?s2member_file_download=00qprac.pdf">Download< /a>

That works.

Now when in to a subfolder of a file that has spaces in the file name it doesn’t work. The s3 link works when put in to the browser, as noted above, but when ran through s2member it fails…here is that link:

< a href="/?s2member_file_download=001+Mathematics/01.1+Algebra+Concept+Overview.pdf">Download2< /a>

So is this an error because of the “+” characters used?

If so, is there a workaround?

EDIT: needed to make spaces in the < a tags so they didn’t format as links in the post

Alright, so I debugged down to figuring that it was the spaces in the file names on s3. If there are spaces in a PDF title, s3 will add a “+” and works fine with them, but if I run them through the s2 script, it breaks.

I’ve found that if I replace the spaces with underscores, then I can get them all to work, but there are nearly 600 files I would have to do this to on the s3 side, and then also make the change on my site for the PDF viewer.

Hoping someone would have some insight, thank you

Spaces in file names and paths are always a no-no on Linux, which is almost certainly the O/S you are using on both platforms.

If the file paths are stored in the WP database, you could use one of the Search and Replace plugins to change things (but test first: they are very powerful). Otherwise, manual changes will be necessary.

Tim,

Thanks my man, so that is the case…I will figure out a path forward. I know how I could search/replace in the wp db, but would you know a way to do it inside an s3 bucket? I know that’s the scope of s2, but just curious if you had some direction.

Sorry, I’m afraid I don’t. Perhaps someone at Amazon could help.