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

Hard link serve panic fix #2210

Merged
merged 5 commits into from
May 6, 2023
Merged

Conversation

Raymi306
Copy link
Contributor

@Raymi306 Raymi306 commented May 2, 2023

IMPORTANT: Please do not create a Pull Request adding a new feature without discussing it first.

The place to discuss new features is the forum: https://zola.discourse.group/
If you want to add a new feature, please open a thread there first in the feature requests section.

Sanity check:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code changes

(Delete or ignore this section for documentation changes)

  • Are you doing the PR on the next branch?

If the change is a new feature or adding to/changing an existing one:

  • Have you created/updated the relevant documentation page(s)?

Fixes #2081

}
}
if let Err(e) = std::fs::hard_link(src, dest) {
console::error(&format!("File System Error, src: {:?}, dst: {:?}", src, dest));
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to import console, just return an error for both

@Raymi306 Raymi306 requested a review from Keats May 4, 2023 22:52
@Raymi306 Raymi306 force-pushed the hard-link-serve-panic-fix branch from 1848091 to f95b4f5 Compare May 5, 2023 02:12
std::fs::hard_link(src, dest)?
if dest.exists() {
std::fs::remove_file(dest)
.with_context(|| format!("Error removing file, dst: {:?}", dest))?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

dst is not going to be clear to the end error, just put Error removing file: {:?}

.with_context(|| format!("Error removing file, dst: {:?}", dest))?;
}
std::fs::hard_link(src, dest)
.with_context(|| format!("Error linking file, src: {:?}, dst: {:?}", src, dest))?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Error linking file -> Error hard linking file

Copy link
Collaborator

@Keats Keats left a comment

Choose a reason for hiding this comment

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

Thanks!

@Keats Keats merged commit 1321a83 into getzola:next May 6, 2023
peterprototypes pushed a commit to peterprototypes/zola that referenced this pull request Sep 12, 2023
* Fix hard link panic and add better error info to std:fs errors

* cargo fmt

* Remove erroneously committed config change

* Remove console import; Use with context to provide additional error info

* improve error wording
technimad pushed a commit to technimad/zola that referenced this pull request Sep 30, 2023
* Fix hard link panic and add better error info to std:fs errors

* cargo fmt

* Remove erroneously committed config change

* Remove console import; Use with context to provide additional error info

* improve error wording
Keats pushed a commit that referenced this pull request Dec 18, 2023
* Fix hard link panic and add better error info to std:fs errors

* cargo fmt

* Remove erroneously committed config change

* Remove console import; Use with context to provide additional error info

* improve error wording
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