Skip to content

Commit

Permalink
fix: OPTIC-1509: Fix information exposure when tasks import failed (#…
Browse files Browse the repository at this point in the history
…7004)

Co-authored-by: mcanu <[email protected]>
  • Loading branch information
mcanu and mcanu authored Feb 5, 2025
1 parent 57affbe commit 2638f0f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion label_studio/data_import/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def has_permission(self, user):
def filepath(self):
return self.file.name

@cached_property
def file_name(self):
return os.path.basename(self.file.name)

@property
def url(self):
if settings.FORCE_SCRIPT_NAME and not (settings.HOSTNAME and settings.CLOUD_FILE_STORAGE_ENABLED):
Expand Down Expand Up @@ -149,7 +153,7 @@ def read_tasks(self, file_as_tasks_list=True):
tasks = self.read_task_from_uploaded_file()

except Exception as exc:
raise ValidationError('Failed to parse input file ' + self.filepath + ': ' + str(exc))
raise ValidationError('Failed to parse input file ' + self.file_name + ': ' + str(exc))
return tasks

@classmethod
Expand Down

0 comments on commit 2638f0f

Please sign in to comment.