Bug Description
When uploading an image via POST /api/v1/resources with source_name specified, the internal filename inside the resource directory still uses the original temp file name (e.g., upload_3ab9f7ac399845b1825813c2e4f21cf2.png) instead of the custom name.
This behavior is inconsistent with document types (Markdown, PDF), which correctly respect source_name.
Steps to Reproduce
# 1. Upload temp file
curl -X POST /api/v1/resources/temp_upload -F 'file=@photo.png'
# → { "temp_file_id": "upload_xxx.png" }
# 2. Create resource with source_name
curl -X POST /api/v1/resources \
-H 'Content-Type: application/json' \
-d '{
"temp_file_id": "upload_xxx.png",
"to": "viking://resources/my-agent/images/photo",
"source_name": "photo.png"
}'
# 3. List resource contents
curl /api/v1/fs/ls?uri=viking://resources/my-agent/images/photo
Expected Behavior
{ "uri": "viking://resources/my-agent/images/photo/photo.png" }
Actual Behavior
{ "uri": "viking://resources/my-agent/images/photo/upload_xxx.png" }
Minimal Reproducible Example
Error Logs
OpenViking Version
0.3.3
Python Version
3.11
Operating System
Linux
Model Backend
None
Additional Context
Root Cause
media_processor.py:175 sets resource_name for all file types:
parse_kwargs["resource_name"] = Path(source_name).stem if source_name else file_path.stem
MarkdownParser correctly reads this parameter (markdown.py:177):
explicit_name = kwargs.get("resource_name") or kwargs.get("source_name")
doc_title = Path(explicit_name).stem if explicit_name else Path(source_path).stem
However, ImageParser.parse() (parsers/media/image.py:105-107) completely ignores it and hardcodes the original filename:
original_filename = file_path.name.replace(" ", "_") # always temp file name
stem = file_path.stem.replace(" ", "_")
Bug Description
When uploading an image via
POST /api/v1/resourceswithsource_namespecified, the internal filename inside the resource directory still uses the original temp file name (e.g.,upload_3ab9f7ac399845b1825813c2e4f21cf2.png) instead of the custom name.This behavior is inconsistent with document types (Markdown, PDF), which correctly respect
source_name.Steps to Reproduce
Expected Behavior
{ "uri": "viking://resources/my-agent/images/photo/photo.png" }Actual Behavior
{ "uri": "viking://resources/my-agent/images/photo/upload_xxx.png" }Minimal Reproducible Example
Error Logs
OpenViking Version
0.3.3
Python Version
3.11
Operating System
Linux
Model Backend
None
Additional Context
Root Cause
media_processor.py:175setsresource_namefor all file types:MarkdownParsercorrectly reads this parameter (markdown.py:177):However,
ImageParser.parse()(parsers/media/image.py:105-107) completely ignores it and hardcodes the original filename: