automa icon indicating copy to clipboard operation
automa copied to clipboard

`Handle Download` Block - file path is not assigned to the variable

Open xartuu opened this issue 1 year ago • 4 comments

Describe the bug After using the Handle download block, when the file is already downloaded and the next block is started, the file path of the downloaded file is not assigned to the set variable.

To Reproduce Steps to reproduce the behavior:

  1. Use the Handle download block.
  2. Check the Wait for the file to be downloaded setting and enter the variable name in Assign to variable.
  3. Run the workflow and download the file from any site
  4. Go into the workflow logs and see if the variable has assigned itself

Expected behavior After using the Handle download block, the `{{variables.path}} variable should contain the path to the downloaded file.

Screenshots image image

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Brave Browser
  • Extension Version: 1.28.27

Additional context Add any other context about the problem here.

xartuu avatar Oct 31 '24 16:10 xartuu

The processing download module may not get the file path immediately, you can add a delay

pzw943969386 avatar Dec 26 '24 06:12 pzw943969386

I added a delay and tested:

  • the file is downloaded in 2 seconds
  • module after 20 seconds does not return the path
  • module changes the previously set variable and leaves it empty
image

xartuu avatar Dec 28 '24 15:12 xartuu

image Delay use before processing downloads

pzw943969386 avatar Dec 30 '24 08:12 pzw943969386

Still the module does not get the file path

image

xartuu avatar Dec 30 '24 17:12 xartuu

Hello, I don't want this issue to die. The problem is still not fixed and the feature is not working. Can you find someone willing to fix it?

xartuu avatar Mar 07 '25 00:03 xartuu

Hello, I don't want this issue to die. The problem is still not fixed and the feature is not working. Can you find someone willing to fix it?

@xartuu

Thank you for your message. I'm sorry for the delay in getting to it. I'll try to reproduce and fix the issue. It seems like a bug. If you can provide a minified, reproducible workflow (exported as a JSON file) with desensitized data, it would be very helpful.

bingren-yd avatar Mar 07 '25 13:03 bingren-yd

I don't know how to reproduce my situation, as it occurs on a business portal with limited access. Overall, I click on a button that is supposed to generate a report with data (in .xlsx Excel). From what I can tell, JS processes the data, as the site does not send any request, and then a window pops up to save the file.

Along with my comment, I poked around a bit in the Automa code and came to a way that restores the operation in my case. I would describe it as “processing nearest/future download”. In short if the downloadId is not specified it listens for the download and if there is no filename when the download is finished it checks it in the Chrome API.

https://github.com/xartuu/automa/commit/0ce148ba3dd4ecad5a27bb3b884cacbaefd60049

xartuu avatar Mar 10 '25 01:03 xartuu

@bingren-yd did you take a look at it^?

xartuu avatar Mar 13 '25 19:03 xartuu

@bingren-yd did you take a look at it^?

Yes, I apologize for the slight delay. I've reviewed the code you provided, and it looks correct.

There's just one more step that would be helpful. If you could create a PR request in the Automa project following the GitHub flow (and then I'll merge it into the main branch), it would be much appreciated. This way, you'll be automatically credited in the next changelog and release, as you were the one who discovered and resolved the issue.

@xartuu

bingren-yd avatar Mar 14 '25 09:03 bingren-yd