Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using PathNameForDownloadedFile: Android suffixes filename by '-1' if file already exists #69

Closed
BtrJay opened this issue Sep 25, 2017 · 5 comments

Comments

@BtrJay
Copy link
Contributor

BtrJay commented Sep 25, 2017

Hi @SimonSimCity ,

I've found an issue that when I set PathNameForDownloadedFile for Android before calling

             downloadManager.PathNameForDownloadedFile = downloadFile => filePath; 

i.e. /storage/emulated/0/Android/data/com.builttoroam.podcast/files/Download/a2da6a8b-2b67-44ba-8478-2661/Audio.mp3

            var file = downloadManager.CreateDownloadFile(url);
            file.PropertyChanged += OnFilePropertyChanged;
            downloadManager.Start(file);
            
            // After this line, Android will create Audio.mp3 (empty) and Audio-1.mp3 (actual content is 
            written here)

Have you ever seen this issue before?

I've got this file path from PCLStorage plugin and seems working with iOS && UWP fine.

Just Android is where this issue has been come from.

Kind Regards,

Jay

@SimonSimCity
Copy link
Owner

Hi, @BtrJay

I just had this when starting the download twice - and that was expected. Can you please create a fork of this repository and change the example, so you get it there as well? I'll then have a closer look at it and find a way to fix it.

@BtrJay
Copy link
Contributor Author

BtrJay commented Sep 25, 2017

@SimonSimCity,

Sure, I will create a pull request for that shortly.

Kind Regards,

Jay Sim

@BtrJay
Copy link
Contributor Author

BtrJay commented Sep 26, 2017

Hi @SimonSimCity ,

I've created the pull request that creates the test for Android where you can replicate the issue I have.

Please have a look.

Kind Regards,

Jay Sim

@BtrJay
Copy link
Contributor Author

BtrJay commented Sep 26, 2017

My latest PR should include the fixes for this issue.

Please have a look and let me know if you have any issues/concerns.

Regards,

Jay

@SimonSimCity SimonSimCity changed the title android: Setting PathNameForDownloadedFile duplicates files Using PathNameForDownloadedFile: Android suffixes filename by '-1' if file already exists Sep 26, 2017
@SimonSimCity
Copy link
Owner

Thanks very much, I've fixed it, closed the PR and uploaded a new version (v1.3.2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants