aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/enrichment.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-14 11:17:38 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-14 11:17:38 +0200
commitdaec4bc6a2a9f9e038e5269586b06018ff327a27 (patch)
treec34c58aad624d594dbb1aa8a47f71ab38a5e3081 /packages/meshbay-node/src/meshbay_node/enrichment.py
parent80ac882346b474bb7ea4e8c8afd4694bd13dd9dd (diff)
downloadmeshbay-daec4bc6a2a9f9e038e5269586b06018ff327a27.tar.gz
fix(node): index, serve and write files past Windows' MAX_PATHHEADmain
With the system's default setting (LongPathsEnabled off) every call given a plain path of 260 characters or more refuses it, so a deep library was partly invisible: the walk could not list such a directory and its files never reached the members. The node now hands each call that touches a group's disk the extended form (paths.long_path), and keeps the plain path in the index, the hash cache and the log. A directory is listed under its long form and its entries named from the plain one (indexer.walk_files, wire._walk_dirs). Covered: the walk, stats and hashing, reconcile and the watcher, the folder list members see, serving over WebRTC and QUIC, deletion, uploads and their recovery, folder creation and removal, audio tags and the cover beside a track, photos, and a show's episode numbering. ffmpeg extends a long path itself and keeps the plain one. long_path now normalises before prefixing (the extended form skips the system's normalisation) and starts at 248 characters, where creating a directory is already refused. test_long_paths.py runs with the setting off: 15 of its 17 tests fail without the change. Checked by hand in the installed app with files at 312 to 380 characters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/enrichment.py')
-rw-r--r--packages/meshbay-node/src/meshbay_node/enrichment.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/enrichment.py b/packages/meshbay-node/src/meshbay_node/enrichment.py
index 19aafba..c09c5e5 100644
--- a/packages/meshbay-node/src/meshbay_node/enrichment.py
+++ b/packages/meshbay-node/src/meshbay_node/enrichment.py
@@ -2,8 +2,11 @@
thumbnail for Videos, tags and cover for Music, thumbnail and EXIF for Photos.
NodeDaemon runs it; the enrichers themselves are in indexer/."""
+import os
from dataclasses import replace
+from meshbay_common.paths import long_path
+
from meshbay_node.indexer import DirectoryIndexer, GroupIndex
from meshbay_node.roots import entry_abs_path
@@ -67,7 +70,7 @@ class EnrichmentMixin:
if not _under_any_directory(entry.path, video_dirs):
continue
file_path = entry_abs_path(indexer.roots, entry)
- if not file_path or not file_path.exists():
+ if not file_path or not os.path.exists(long_path(file_path)):
continue
self._enriched_attempted.add((indexer.group_id, entry.id))
@@ -153,7 +156,7 @@ class EnrichmentMixin:
if owner is None:
continue
file_path = entry_abs_path(indexer.roots, entry)
- if not file_path or not file_path.exists():
+ if not file_path or not os.path.exists(long_path(file_path)):
continue
self._enriched_attempted.add((indexer.group_id, entry.id))
@@ -236,7 +239,7 @@ class EnrichmentMixin:
if not _under_any_directory(entry.path, photo_dirs):
continue
file_path = entry_abs_path(indexer.roots, entry)
- if not file_path or not file_path.exists():
+ if not file_path or not os.path.exists(long_path(file_path)):
continue
self._enriched_attempted.add((indexer.group_id, entry.id))