From 21f0498f62ada55651f4d232327e15fc47f498b1 Mon Sep 17 00:00:00 2001
From: Bin <bin.zheng@slooong.com>
Date: 星期三, 17 十二月 2025 11:40:15 +0800
Subject: [PATCH] 图片路径测试

---
 label_studio/data_import/models.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/label_studio/data_import/models.py b/label_studio/data_import/models.py
index ee40539..016ada7 100644
--- a/label_studio/data_import/models.py
+++ b/label_studio/data_import/models.py
@@ -238,10 +238,11 @@
 
     def read_task_from_uploaded_file(self):
         logger.debug('Read 1 task from uploaded file {}'.format(self.filepath))
-        if settings.CLOUD_FILE_STORAGE_ENABLED:
-            tasks = [{'data': {settings.DATA_UNDEFINED_NAME: self.filepath}}]
-        else:
-            tasks = [{'data': {settings.DATA_UNDEFINED_NAME: self.url}}]
+        # 使用相对路径而不是URL,这样:
+        # 1. 不会暴露完整的系统路径
+        # 2. Converter 能够正确解析路径(相对于 MEDIA_ROOT/UPLOAD_DIR)
+        # 例如:'upload/1/xxx.png' 而不是 '/data/upload/1/xxx.png'
+        tasks = [{'data': {settings.DATA_UNDEFINED_NAME: self.filepath}}]
         return tasks
 
     @property

--
Gitblit v1.9.3