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

add definition for file & folder extensions #23

Merged
merged 5 commits into from
May 26, 2022
Merged
Changes from 2 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
70 changes: 64 additions & 6 deletions docs/collisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,61 @@ For example if a folder has five 5 with the same name say **_A.txt _** the five
* [Extensions in folder names matter](https://apple.stackexchange.com/questions/123001/renamed-folder-becomes-a-file-with-an-extension) and should be handled :
* Case sensitivity is taken into account. `Myfile` and `myFile` are different for example. That is useful to [ensure complete syncs](https://rclone.org/overview/#case-insensitive).

#### Extensions

For both files and folders the extension is any string that follows after the last dot.

For example:
<table>
<thead>
<th>File/Folder Name</th>
<th>Extension</th>
<th>Remark</th>
</thead>
<tbody>
<tr>
<td>My File.txt</td>
<td>txt</td>
<td>Regular</td>
</tr>
<tr>
<td>My File.txt(1)</td>
<td>txt(1)</td>
<td>Extension contains non-alphanumeric chars</td>
</tr>
<tr>
<td>My File.app</td>
<td>app</td>
<td>Regular</td>
</tr>
<tr>
<td>something.something</td>
<td>something</td>
<td>Name same as extension</td>
</tr>
<tr>
<td>2022.03.02</td>
<td>02</td>
<td>Extension is number</td>
</tr>
<tr>
<td>Folder.Work Files</td>
<td>Work Files</td>
<td>Extension contains spaces</td>
</tr>
</tbody>
</table>

As seen, extension can take infinite number of "shapes" BUT as long as all characters in the file name including the extension are valid file name chacters, then, **the extension is the string tha follows after the last dot** (Emphasis).


#### Source of extensions

a) The **source string for file extensions ON FILES** is the **`uploadFileName`** because that's the only place where it is maintained after a file is first uploaded in Permanent. In other words permanent takes a file and then removes its extension and then what is left is called the `displayName`

b) The **source string for file extensions ON FOLDERS** is the `displayName` because Permanent does not (or at least did not ) do any kind of extension proccessing on folders, hence folder extensions are always visible in their `displayName`.


### Reserved/unsupported characters

Characters that do not map to various file systems would be encoded. For example, `/` is not allowed in file names in all operating systems, while Windows goes ahead to restrict a lot more characters including `*`, `<`, `>`, `/`, `:`, `"` and `|`.
Expand Down Expand Up @@ -394,15 +449,15 @@ NB: downloadFileName & downloadFolderName **should be recalculated after file or
</td>
<td><strong>In progress</strong>
</td>
<td><a href="https://github.com/PermanentOrg/back-end/pull/11">https://github.com/PermanentOrg/back-end/pull/11</a>
<td><a href="https://github.com/PermanentOrg/back-end/pull/40">https://github.com/PermanentOrg/back-end/pull/40</a>
</td>
</tr>
<tr>
<td>2
</td>
<td><strong>In progress</strong>
</td>
<td><a href="https://github.com/PermanentOrg/back-end/pull/11">https://github.com/PermanentOrg/back-end/pull/11</a>
<td><a href="https://github.com/PermanentOrg/back-end/pull/40">https://github.com/PermanentOrg/back-end/pull/40</a>
</td>
</tr>
<tr>
Expand All @@ -418,10 +473,13 @@ NB: downloadFileName & downloadFolderName **should be recalculated after file or

## Testing Plan

- Test generates unique & correctly formatted `downloadName` for n colliding files in the same namespace (parent folder).
- Test generates unique & correctly formatted `downloadName` for n colliding folders in the same namespace.
- Test generates unique & correctly formatted `downloadName` for n colliding files & folders in the same namespace.
- Test generates unique & correctly formatted `downloadName` for incoming files and folders holding colliding deduplication strings.
- Test generates directory-unique & correctly formatted `downloadName` for n colliding files in the same namespace (parent folder).
- Test generates directory-unique & correctly formatted `downloadName` for n colliding folders in the same namespace.
- Test generates directory-unique & correctly formatted `downloadName` for n colliding files & folders in the same namespace.
- Test generates directory-unique & correctly formatted `downloadName` for incoming files and folders holding colliding deduplication strings.
- Test generates directory-unique & correctly formatted `downloadName` for files and folders with uncommon naming styles.

*Directory-unique: Download names need be unique only for files and folders in thesame directory*


# Synchronization
Expand Down