Jellyfin-Migrator icon indicating copy to clipboard operation
Jellyfin-Migrator copied to clipboard

[Bug]: `PosixPath` has no method `startswith`

Open mtalexan opened this issue 1 year ago • 3 comments

Lines 526 and 527 of of jellyfin_migrator.py are trying to determine if the Path object (d) starts with a fixed prefix.

Traceback (most recent call last):
  File "jellyfin_migrator.py", line 1273, in <module>
    process_files(
  File "jellyfin_migrator.py", line 995, in process_files
    target = get_target(
  File "jellyfin_migrator.py", line 822, in get_target
    target, idgaf1, idgaf2 = recursive_root_path_replacer(original_source, to_replace=replacements)
  File "jellyfin_migrator.py", line 520, in recursive_root_path_replacer
    and not d.startswith("https:") \
AttributeError: 'PosixPath' object has no attribute 'startswith'

As shown on line 514, it needs as_posix() called on it first. For example:

-                        and not d.startswith("https:") \
-                        and not d.startswith("http:") \
+                        and not d.as_posix().startswith("https:") \
+                        and not d.as_posix().startswith("http:") \

mtalexan avatar Jan 16 '24 02:01 mtalexan