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

updog: only remove known extensions from migration filenames #662

Merged
merged 1 commit into from
Jan 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions workspaces/updater/updog/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ fn write_target_to_disk<P: AsRef<Path>>(
.read_target(target)
.context(error::Metadata)?
.context(error::TargetNotFound { target })?;
// Note: the file extension for the compression type we're using should be removed in
// retrieve_migrations below.
let mut reader = lz4::Decoder::new(reader).context(error::Lz4Decode { target })?;
let mut f = OpenOptions::new()
.write(true)
Expand Down Expand Up @@ -300,10 +302,12 @@ fn retrieve_migrations(
}

// download each migration, making sure they are executable and removing
// any extension (eg, .lz4)
// known extensions from our compression, e.g. .lz4
for name in migration_targets(*start, *target, &manifest)? {
let mut destination = dir.join(&name);
destination.set_extension("");
if destination.extension() == Some("lz4".as_ref()) {
destination.set_extension("");
}
write_target_to_disk(repository, &name, &destination)?;
fs::set_permissions(&destination, Permissions::from_mode(0o755))
.context(error::SetPermissions { path: destination })?;
Expand Down