| | |
| | | |
| | | def read_task_from_uploaded_file(self): |
| | | logger.debug('Read 1 task from uploaded file {}'.format(self.filepath)) |
| | | # 使用相对路径而不是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}}] |
| | | if settings.CLOUD_FILE_STORAGE_ENABLED: |
| | | tasks = [{'data': {settings.DATA_UNDEFINED_NAME: self.filepath}}] |
| | | else: |
| | | tasks = [{'data': {settings.DATA_UNDEFINED_NAME: self.url}}] |
| | | return tasks |
| | | |
| | | @property |