files.com 1.1.743 → 1.1.744
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +17 -22
- data/_VERSION +1 -1
- data/lib/files.com/path_util.rb +4 -11
- data/lib/files.com/version.rb +1 -1
- data/shared/comparison_examples.json +20 -0
- data/shared/normalization_for_comparison_test_data.json +11 -11
- data/shared/path_comparison.json +20621 -0
- data/shared/path_comparison.md +20 -0
- data/spec/path_util_spec.rb +8 -0
- data/test.sh +3 -3
- metadata +4 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b8af62f099ab3fe1820b5ff20e5dc202bee1a742c42505961cd9d00c7c894d66
|
|
4
|
+
data.tar.gz: 337cc2a388ec0cc310a9fe9473906ce64eeaa20bd8a17ea74b9c2dc1a43f6ef8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c30b00f9b88d92ea33ba15f91cf370478862dce94240b2118027294efeb76a24885a0f100cfb7ee6771e51ff3c84d0bb2f20edd688bb7972ba72178db7e8ffda
|
|
7
|
+
data.tar.gz: 8a559215377d6c771e06610d57ac45e29d30ee1a0a7c51945a77ee620e650a450892964060de75d255cdf21610969116e5adaa9df35a5983507d9c48598db27d
|
data/README.md
CHANGED
|
@@ -346,16 +346,16 @@ end
|
|
|
346
346
|
|
|
347
347
|
## Paths
|
|
348
348
|
|
|
349
|
-
|
|
349
|
+
Files.com preserves the spelling of file and folder paths while comparing them using shared case and Unicode rules. Use the SDK comparison helpers when matching paths locally.
|
|
350
350
|
<div></div>
|
|
351
351
|
|
|
352
352
|
### Capitalization
|
|
353
353
|
|
|
354
|
-
Files.com
|
|
354
|
+
Files.com uses case-insensitive path matching based on its fixed Unicode comparison map.
|
|
355
355
|
|
|
356
|
-
For example,
|
|
356
|
+
For example, the following paths have the same comparison key:
|
|
357
357
|
|
|
358
|
-
| Path Variant |
|
|
358
|
+
| Path Variant | Comparison Key |
|
|
359
359
|
|---------------------------------------|------------------------------|
|
|
360
360
|
| `Documents/Reports/Q1.pdf` | `documents/reports/q1.pdf` |
|
|
361
361
|
| `documents/reports/q1.PDF` | `documents/reports/q1.pdf` |
|
|
@@ -370,32 +370,27 @@ See also: [Case Sensitivity Documentation](https://www.files.com/docs/files-and-
|
|
|
370
370
|
|
|
371
371
|
### Slashes
|
|
372
372
|
|
|
373
|
-
|
|
373
|
+
Use `/` between folder and file names, without leading or trailing slashes. SDK normalization helpers convert backslashes to `/`, remove duplicate separators, and discard exact `.` and `..` components. Discarding `..` leaves the preceding folder name intact.
|
|
374
374
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
|
379
|
-
|
|
|
380
|
-
| `folder/
|
|
381
|
-
|
|
|
375
|
+
| Input | Normalized path |
|
|
376
|
+
|-------|-----------------|
|
|
377
|
+
| `folder/subfolder/file.txt` | `folder/subfolder/file.txt` |
|
|
378
|
+
| `/folder/subfolder/file.txt` | `folder/subfolder/file.txt` |
|
|
379
|
+
| `folder/subfolder/file.txt/` | `folder/subfolder/file.txt` |
|
|
380
|
+
| `//folder//file.txt` | `folder/file.txt` |
|
|
381
|
+
| `folder/../file.txt` | `folder/file.txt` |
|
|
382
382
|
|
|
383
383
|
<div></div>
|
|
384
384
|
|
|
385
|
-
### Unicode
|
|
385
|
+
### Unicode and Path Comparison
|
|
386
386
|
|
|
387
|
-
Files.com
|
|
387
|
+
Files.com compares paths using a fixed mapping shared by the server and SDKs. It treats case and many accent differences as equivalent: `Résumé.txt` and `resume.txt` identify the same file, as do `q` followed by a combining acute accent and `q`. The mapping also handles other equivalences, such as Hiragana and Katakana. Lowercasing or applying a standard Unicode normalization form alone does not reproduce these rules.
|
|
388
388
|
|
|
389
|
-
|
|
389
|
+
SDK comparison helpers normalize path separators and dot segments, then apply the bundled [versioned comparison map](https://github.com/Files-com/files-sdk-javascript/blob/master/shared/path_comparison.json). The [shared examples](https://github.com/Files-com/files-sdk-javascript/blob/master/shared/comparison_examples.json) give exact comparison results for integrations that implement their own matching. The map uses hexadecimal Unicode scalar values as keys: a missing entry preserves the character, an empty replacement removes it, and other replacements may contain several characters. Apply each replacement once without normalizing or lowercasing the result again.
|
|
390
390
|
|
|
391
|
-
|
|
392
|
-
|----------------------------------------|------------------------|
|
|
393
|
-
| `uploads/\u0065\u0301.txt` | `uploads/é.txt` |
|
|
394
|
-
| `docs/Café/Report.txt` | `docs/Café/Report.txt` |
|
|
391
|
+
Use comparison results only for matching. Send the original path spelling in API requests and preserve it for display and local filenames; comparison results can have a different spelling or length.
|
|
395
392
|
|
|
396
|
-
|
|
397
|
-
- Precomposed and decomposed characters are unified.
|
|
398
|
-
- This affects search, deduplication, and comparisons across SDKs.
|
|
393
|
+
Trailing whitespace is significant for comparison. `report.txt` and `report.txt ` are different file paths, and SDK helpers preserve spaces, tabs, and newlines. Folder names cannot end in whitespace. See [Unicode Normalization](https://www.files.com/docs/files-and-folders/file-system-semantics/unicode-normalization) for the complete path rules.
|
|
399
394
|
|
|
400
395
|
<div></div>
|
|
401
396
|
|
data/_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.1.
|
|
1
|
+
1.1.744
|
data/lib/files.com/path_util.rb
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
3
5
|
module Files
|
|
4
6
|
module PathUtil
|
|
5
|
-
|
|
7
|
+
COMPARISON_MAP = JSON.parse(File.read(File.expand_path("../../shared/path_comparison.json", __dir__))).fetch("mapping").to_h { |hex, value| [ hex.to_i(16).chr(Encoding::UTF_8), value.freeze ] }.freeze
|
|
6
8
|
|
|
7
9
|
def self.normalize_for_comparison(*args)
|
|
8
|
-
|
|
10
|
+
normalize(*args).gsub(/[^ -@\[-~]/) { |character| COMPARISON_MAP.fetch(character, character) }
|
|
9
11
|
end
|
|
10
12
|
|
|
11
13
|
def self.same?(a, b)
|
|
@@ -39,14 +41,5 @@ module Files
|
|
|
39
41
|
new_string.force_encoding("ISO-8859-1").encode("UTF-8")
|
|
40
42
|
end
|
|
41
43
|
end
|
|
42
|
-
|
|
43
|
-
private_class_method def self.unicode_normalize_and_transliterate(string)
|
|
44
|
-
# convert multi-code-point characters into single-code-point characters
|
|
45
|
-
normalized_string = string.unicode_normalize(:nfkc)
|
|
46
|
-
|
|
47
|
-
normalized_string.gsub(/[^\x00-\x7f]/u) do |char|
|
|
48
|
-
TRANSLIT_MAP[char] || char
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
44
|
end
|
|
52
45
|
end
|
data/lib/files.com/version.rb
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[
|
|
2
|
+
["Résumé.TXT", "resume.txt"],
|
|
3
|
+
["q́/ậ.txt", "q/a.txt"],
|
|
4
|
+
["ς/Σ/ά", "σ/σ/α"],
|
|
5
|
+
["か/カ/ガ", "か/か/か"],
|
|
6
|
+
["private\u00ad\u200d\ufe0f/file", "private/file"],
|
|
7
|
+
["\u0307", ""],
|
|
8
|
+
["a\u0001b", "ab"],
|
|
9
|
+
["folder \t", "folder \t"],
|
|
10
|
+
["Ა/ა", "Ა/ა"],
|
|
11
|
+
["\u09cb/\u09c7\u09be", "\u09cb/\u09c7\u09be"],
|
|
12
|
+
["ка/का/क", "ка/का/क"],
|
|
13
|
+
["й/и", "й/и"],
|
|
14
|
+
["日本語", "日本語"],
|
|
15
|
+
["가/가", "가/가"],
|
|
16
|
+
["A/B/℀/…", "a/b/a/c/..."],
|
|
17
|
+
["𐐀/𐐨", "𐐨/𐐨"],
|
|
18
|
+
["𠀀/𠀁", "𠀀/𠀁"],
|
|
19
|
+
["ﷺ", "صلى الله"]
|
|
20
|
+
]
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
[ "A\\B\\C.TXT", "a/b/c.txt" ],
|
|
9
9
|
[ "A/B\\C.TXT", "a/b/c.txt" ],
|
|
10
10
|
[ "//a/b//c.txt", "a/b/c.txt" ],
|
|
11
|
-
[ "a/b/c.txt ", "a/b/c.txt"
|
|
12
|
-
[ "a/b/c.txt\t", "a/b/c.txt"
|
|
13
|
-
[ "a/b/c.txt\n", "a/b/c.txt"
|
|
14
|
-
[ "a/b/c.txt\r", "a/b/c.txt"
|
|
11
|
+
[ "a/b/c.txt ", "a/b/c.txt "],
|
|
12
|
+
[ "a/b/c.txt\t", "a/b/c.txt\t"],
|
|
13
|
+
[ "a/b/c.txt\n", "a/b/c.txt\n"],
|
|
14
|
+
[ "a/b/c.txt\r", "a/b/c.txt\r"],
|
|
15
15
|
[ " space_at_beginning", " space_at_beginning"],
|
|
16
|
-
[ "space_at_end ", "space_at_end"],
|
|
16
|
+
[ "space_at_end ", "space_at_end "],
|
|
17
17
|
[ "tab\tseparated", "tab\tseparated"],
|
|
18
18
|
[ "<title>hello</hello>", "<title>hello</hello>"],
|
|
19
|
-
[ "안녕하세요", "
|
|
19
|
+
[ "안녕하세요", "안녕하세요"],
|
|
20
20
|
[ "こんにちは", "こんにちは" ],
|
|
21
21
|
[ "今日は", "今日は" ],
|
|
22
22
|
[ "longest_unicode_character_﷽", "longest_unicode_character_﷽"],
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
[ "/../../remote\\path//./to/file.txt", "remote/path/to/file.txt" ],
|
|
28
28
|
[ "one_code_point_ą", "one_code_point_a" ],
|
|
29
29
|
[ "two_code_points_ą", "two_code_points_a" ],
|
|
30
|
-
[ "one_code_point_훯", "one_code_point_
|
|
31
|
-
[ "three_code_points_훯", "three_code_points_
|
|
30
|
+
[ "one_code_point_훯", "one_code_point_훯"],
|
|
31
|
+
[ "three_code_points_훯", "three_code_points_훯"],
|
|
32
32
|
[ "ÞþŊŋŦŧ", "þþŋŋŧŧ" ],
|
|
33
33
|
[ "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ", "aaaaaaaeceeeeiiiidnoooooouuuuyssaaaaaaaeceeeeiiiidnoooooouuuuyy" ],
|
|
34
34
|
[ "ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİIJij", "aaaaaaccccccccddddeeeeeeeeeegggggggghhhhiiiiiiiiiijij" ],
|
|
35
35
|
[ "ĴĵĶķĹĺĻļĽľŁłŃńŅņŇňʼnŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤť", "jjkkllllllllnnnnnnʼnoooooooeoerrrrrrsssssssstttt" ],
|
|
36
36
|
[ "ŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽž", "uuuuuuuuuuuuwwyyyzzzzzz" ],
|
|
37
|
-
[ "😂❤️😍🤣😊🙏💕😭😘👍😅👏😁♥️🔥💔💖💙😢🤔😆🙄💪😉☺️👌🤗", "
|
|
38
|
-
[ "💜😔😎😇🌹🤦🎉💞✌️✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣️", "
|
|
39
|
-
[ "emoji_‼️", "emoji_
|
|
37
|
+
[ "😂❤️😍🤣😊🙏💕😭😘👍😅👏😁♥️🔥💔💖💙😢🤔😆🙄💪😉☺️👌🤗", "😂❤😍🤣😊🙏💕😭😘👍😅👏😁♥🔥💔💖💙😢🤔😆🙄💪😉☺👌🤗"],
|
|
38
|
+
[ "💜😔😎😇🌹🤦🎉💞✌️✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣️", "💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣"],
|
|
39
|
+
[ "emoji_‼️", "emoji_!!"],
|
|
40
40
|
[ "<title>hello<:hello>.txt", "<title>hello<:hello>.txt" ],
|
|
41
41
|
[ "twodotfile..txt", "twodotfile..txt" ],
|
|
42
42
|
[ "three/.../dots_path", "three/.../dots_path" ],
|