[storage]: Storage ref with query params causes app crash #15799
Labels
Needs Attention
This issue needs maintainer attention.
platform: all
Issues / PRs which are for all platforms.
plugin: storage
type: bug
Something isn't working
Is there an existing issue for this?
Which plugins are affected?
Storage
Which platforms are affected?
macOS, Web
Description
I'm trying to get a storage ref from a pre-signed storage URL (where therefore has query params on it for the authentication). If I pass this into FirebaseStorage
refFromUrl
the app hangs and eventually crashes. Confirmed on both web and MacOS. I'm assuming all platforms are affected.Here's the code where it is happening. The app hangs on the
firstMatch
I tested the regex used in regex101
^https?:\/\/(?:storage.googleapis.com|storage.cloud.google.com)(?::\d+)?\/([A-Za-z0-9.\-_]+)\/([^?#]*)*$
And confirmed that if I put querystring params on the url, e.g.
https://storage.googleapis.com/myapp.appspot.com/users/john/chat/image.jpg?foo=bar
Then there's an error:
Catastrophic backtracking has been detected and the execution of your expression has been halted. To find out more and what this is, please read the following article: Runaway Regular Expressions
Reproducing the issue
Call FirebaseStorage.instance.refFromUrl('https://storage.googleapis.com/myapp.appspot.com/users/john/chat/image.jpg?foo=bar')
Firebase Core version
3.3.0
Flutter Version
3.24.4
Relevant Log Output
No response
Flutter dependencies
Expand
Flutter dependencies
snippetReplace this line with the contents of your `flutter pub deps -- --style=compact`.
Additional context and comments
No response
The text was updated successfully, but these errors were encountered: