Why isn't the public URL always generated in File Stash despite successful file download, and how can it be ensured?

This topic was automatically generated from Slack. You can find the original thread here.

Hi there, another File Stash question (still also hoping for an answer to my other question :slightly_smiling_face:).

We just implemented File Stash, which most of the time works great, but I need the public URL to be present as well. Just had a situation where the file was properly downloaded, but the URL wasn’t generated. Why does that happen, and can I force it to always return the URL?

Pipedream Connect Action

gmail-download-attachment({
  "messageId": "...",
  "attachmentId": "...",
  "filename": "Simple Invoice (1).pdf"
})

Output

{"exports":{"$summary":"Successfully created file Simple Invoice (1).pdf in `/tmp` directory","$filestash_uploads":[{"localPath":"/tmp/Simple Invoice (1).pdf","s3Key":".../u/Simple Invoice (1).pdf"}]},"os":[],"ret":{"filename":"Simple Invoice (1).pdf","filePath":"/tmp/Simple Invoice (1).pdf"},"stashId":"..."}

Please let me know why this happens and how I can make sure we reliably get the get_url. Thanks!

Hey . I think that might be a bug. Do you possibly know when this happens or how to reproduce it?

So far it seems to work 100% of the time at least in the gmail-download-attachment in my (admittedly quite limited) test

Do you mean 100% of the time, there’s no get_url when you run the gmail-download-attachment action?

Correct. So far 100% (3 out of 3 times) I haven’t received a get_url

Sorry, see I was unclear. It doesn’t work 100% of the time

Thanks. No worries! I was able to reproduce the bug. It seems to happen when the file name has certain special characters or spaces.

I created a bug report in the pipedream GitHub repository: [BUG] File Stash URL generation fails for files with special characters · Issue #17684 · PipedreamHQ/pipedream · GitHub

As a workaround, until the bug is fixed, you could potentially replace special characters in the filename with underscores (_), for example.

filename: "Simple Invoice (1).pdf".replace(/[^a-zA-Z0-9.]/g, "_")

Good catch!

A fix for this bug was shipped. The output should now have a presigned URL for the file (in get_url) when the file name has spaces or other special characters.