webdriver_manager
webdriver_manager copied to clipboard
Issue with Content-Disposition filename handling in File
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
Hi, @dschwalm. Project is open for PRs :)
@dschwalm feel free to provide a PR for this
@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.
@dschwalm can you test master branch in your case?
@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 :(