Fix backup of folders with escaped characters in their name#265
Open
ashundefined wants to merge 1 commit into
Open
Fix backup of folders with escaped characters in their name#265ashundefined wants to merge 1 commit into
ashundefined wants to merge 1 commit into
Conversation
…g delay_metadata.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix a backup failure for folders whose names contain a character that is
escaped on disk (for example
:).Problem
Serializer::Filesescapes reserved characters when it builds file pathsfor a folder (for example
:becomes%3a;). When thedelay_metadatadownload strategy is used,
DelayedMetadataSerializerbuilt its ownImapand
Mboxobjects directly from the unescaped folder path, bypassing thisescaping.
As a result, the two halves of a backup used different files:
apply_uid_validitywrote the UID validity to the escaped path.commitread and wrote the unescaped path.The UID validity was therefore not found when saving the metadata, and the
backup failed with: "Cannot save metadata without a uid_validity"
A second issue affected reading backups: when restoring, migrating, or
listing local folders, the escaped on-disk name was used as-is instead of
being decoded. A folder backed up as
foo%3a;barwas treated as a folderliterally named
foo%3a;bar.Changes
DelayedMetadataSerializernow uses the serializer'simapandmboxobjects, so it reads and writes the same escaped paths as the rest of the
serializer.
imapandmboxdelegators toSerializer.Account::SerializedFoldersandAccount::FolderMappernow decodeescaped folder names with
Naming.from_local_pathwhen reading a backup.Compatibility
The on-disk format is unchanged. Existing backups are unaffected; the read
path now decodes names that were already being written escaped.
Tests
DelayedMetadataSerializerspec: verifies it uses the serializer'simap/mbox.SerializedFoldersandFolderMapperspecs: verify escaped on-disk namesare decoded when read.