Skip to content

Commit

Permalink
partial fix for #15
Browse files Browse the repository at this point in the history
  • Loading branch information
asiekierka committed Jun 2, 2022
1 parent db2fb65 commit e178112
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web/src/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,22 @@ class BaseStorage {
else if (this.ignoreCase) newKey = newKey.toLowerCase();

if (this.use83Names) {
// TODO: Handle periods better.
// https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/18e63b13-ba43-4f5f-a5b7-11e871b71f14
var nkSplit = newKey.split(".", 2);
var findTildedName = false;
if (nkSplit[0].length > 8) {
nkSplit[0] = nkSplit[0].substring(0, 6);
findTildedName = true;
}
if (nkSplit.length >= 2 && nkSplit[1].length > 3) {
nkSplit[1] = nkSplit[1].substring(0, 3);
}
if (findTildedName) {
var i = 1;
var fnConverted = nkSplit[0].replaceAll(" ", "");
while (1) {
var is = i.toString();
nkSplit[0] = nkSplit[0].substring(0, 7 - is.length) + "~" + is;
nkSplit[0] = fnConverted.substring(0, 7 - is.length) + "~" + is;
newKey = nkSplit.join(".");
if (this.get(newKey) == null) {
break;
Expand Down

0 comments on commit e178112

Please sign in to comment.