nilsbraden / ttrss-reader-fork

An Android-Client for the self-hosted Tiny Tiny RSS feedreader
https://www.nilsbraden.de/TTRSS-Reader/
151 stars 40 forks source link

AsyncMediaDownloader assumes unique names for downloading media #388

Open artbristol opened 5 years ago

artbristol commented 5 years ago

If you subscribe to a podcast where the URL has the same "file name" every time, then using the "Play attached media file" option doesn't work.

For example, on this feed https://feeds.feedburner.com/RichardHerringLSTPodcast you have

All these result in URLUtil.guessFileName returning "media.mp3".

The first download works OK, but subsequent episodes try to resume, because there's already a file called media.mp3. This often results in 404 and a confusing "FileNotFound" exception on the client, since the HTTP range is invalid.

It would be better to use the response's Content-Disposition header's filename, but you can't then set the Range and resume downloads since the request has already been sent.

Maybe download with a temporary, but predictable, filename, then rename on completion?