markmarijnissen / cordova-file-cache

An awesome File Cache for Cordova Apps.
MIT License
87 stars 29 forks source link

File saved with wrong extension if there's a query string in the URL #16

Open icopp opened 8 years ago

icopp commented 8 years ago

In hash mode, caching a Vimeo video with an access token results in a .txt file instead of a .mp4 file. This is with a URL like (for example): https://player.vimeo.com/external/#####.sd.mp4?s=12345abcdef&profile_id=###

The video itself looks like it's saved perfectly fine. Pulling it from a simulator and renaming it from #####.txt to #####.mp4 results in a video file that plays without problems. The problem is only with the wrong file name, since this messes with other plugin usage (for example, supplying the file:// URL to cordova-plugin-streaming-media).

It looks like the problem is that the plugin is just categorically replacing extensions with .txt if there's a query string in the URL. I've made a pull request, #17, that fixes the problem.