Skip to content

Commit cda7466

Browse files
authored
Revert "Separate afc fix; use for abstractmountable" (#2655)
1 parent f1c3cf6 commit cda7466

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

libcore/FileUtils.vala

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -413,31 +413,24 @@ namespace Files.FileUtils {
413413
new_path = new_path.slice (Files.ROOT_FS_URI.length, new_path.length);
414414
}
415415

416-
return new_path;
417-
}
418-
419-
// Removes the unwanted `:3` from some Apple device addresses without full sanitizing
420-
public string fix_afc_uri (string uri) {
421-
if (Uri.parse_scheme (uri).has_prefix ("afc")) {
422-
var colon_parts = uri.split (":", 3);
416+
if (scheme.has_prefix ("afc")) {
417+
var colon_parts = new_path.split (":", 3);
423418
if (colon_parts.length > 2) {
424419
/* It may be enough to only process device addresses but we deal with all afc uris in case.
425420
* We have to assume the true device name does not contain any colons */
426421
var separator_parts = colon_parts[2].split (Path.DIR_SEPARATOR_S, 2);
427422
var device_name_end = separator_parts[0];
428423
if (uint64.try_parse (device_name_end)) {
429424
/* Device ends in e.g. `:3`. Need to strip this suffix to successfully browse */
430-
var fixed_uri = string.join (":", colon_parts[0], colon_parts[1]);
425+
new_path = string.join (":", colon_parts[0], colon_parts[1]);
431426
if (separator_parts.length > 1) {
432-
fixed_uri = string.join (Path.DIR_SEPARATOR_S, fixed_uri, separator_parts[1]);
427+
new_path = string.join (Path.DIR_SEPARATOR_S, new_path, separator_parts[1]);
433428
}
434-
435-
return fixed_uri;
436429
}
437430
}
438431
}
439432

440-
return uri;
433+
return new_path;
441434
}
442435

443436
/** Splits the path into a protocol ending in '://" and a path beginning "/". **/

src/View/Sidebar/AbstractMountableRow.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public abstract class Sidebar.AbstractMountableRow : Sidebar.BookmarkRow, Sideba
9393
string? _uuid) {
9494
Object (
9595
custom_name: name,
96-
uri: Files.FileUtils.fix_afc_uri (uri),
96+
uri: uri,
9797
gicon: gicon,
9898
list: list,
9999
pinned: pinned,

0 commit comments

Comments
 (0)