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

fix: download in case when url file was dropped or any exist() error #18

Merged
merged 2 commits into from
Jul 16, 2024

Conversation

brusherru
Copy link
Member

Fixes some edge-cases which produces bugs, like this one:
image

@brusherru brusherru requested review from pigmej and poszu July 15, 2024 13:40
@brusherru brusherru self-assigned this Jul 15, 2024
@brusherru brusherru merged commit 0bbe40a into main Jul 16, 2024
19 checks passed
@brusherru brusherru deleted the fix-download branch July 16, 2024 09:56
@@ -91,7 +91,7 @@ fn go_spacemesh_default_path() -> &'static str {
}

fn backup_or_fail(file_path: &PathBuf) -> () {
if file_path.exists() {
if file_path.try_exists().unwrap_or(false) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's a good idea to unwrap Err to false. An error could mean a lack of permissions (https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.try_exists). In such a situation, it's probably best to fail and to advice the user to verify rather than just not back the files up. Wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. You're right! 👍

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

Successfully merging this pull request may close these issues.

2 participants