webdriver_manager icon indicating copy to clipboard operation
webdriver_manager copied to clipboard

Issue with Content-Disposition filename handling in File

Open dschwalm opened this issue 3 years ago • 2 comments

Hi,

filename can occur multiple times in Content-Disposition header, for example when using Artifactory in enterprise environment:

Content-Disposition: attachment; filename="chromedriver_win32.zip"; filename*=utf-8''chromedriver_win32.zip

The extacted file name will be: chromedriver_win32.zip; filename*=utf-8''chromedriver_win32.zip which is an invalid file name in Windows so it cannot be saved to the file system.

This regex should be fixed I think: https://github.com/SergeyPirogov/webdriver_manager/blob/master/webdriver_manager/utils.py#L24

Is it ok to create a pull request for the same?

Description of Content-Disposition:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#directives

Other libraries like Akka also faced and fixed this issue: https://github.com/akka/akka-http/issues/1240

Regards, Daniel

dschwalm avatar Apr 13 '22 09:04 dschwalm

Hi, @dschwalm. Project is open for PRs :)

aleksandr-kotlyar avatar Apr 16 '22 06:04 aleksandr-kotlyar

@dschwalm feel free to provide a PR for this

SergeyPirogov avatar May 22 '22 17:05 SergeyPirogov

@dschwalm hi! I checked the example in your topic and we really have an issue here. I have been spent about 5 hours today searching and testing a regex that should work with your example in various combinations.

filename.+"(.+)"|filename.+''(.+)

I am making autotests for this regexp now and will push a PR tomorrow.

aleksandr-kotlyar avatar Apr 22 '23 21:04 aleksandr-kotlyar

@dschwalm can you test master branch in your case?

aleksandr-kotlyar avatar Jul 07 '23 19:07 aleksandr-kotlyar

@aleksandr-kotlyar thanks for the fix. I don't work on the project any more so I don't have access to the code any more to test it :(

dschwalm avatar Jul 07 '23 19:07 dschwalm