[Question]: How to preserve original filename/path after upload?
Issue Origin
Observed or reproduced in a real environment
Your Question
Hi,
I’m using OpenViking, and I noticed that when a file is uploaded, it appears to be converted into a .md file.
Because of this conversion, the original filename and file path seem to be lost. As a result, the bot cannot reliably indicate where the original file came from.
Would it be possible for OpenViking to:
-
Return the original file location
- Return the original full filename, including its extension, together with the original file path.
- For example:
/path/to/original-file.pdf.
-
Reference or surface the original file in chat
- For example, if the uploaded file is a PDF, it would be helpful for the bot to reference or present the original PDF instead of only referring to the converted Markdown version.
Current behavior
Currently, uploaded files seem to be converted to .md, and the original filename/path does not appear to be preserved. Because of this, the bot cannot determine or return where the original file was found.
Question
What is the easiest way to achieve this without writing extra code?
Specifically:
- Is there a built-in way to preserve or store the original filename and path?
- Can OpenViking keep a reference to the original uploaded file after conversion?
- Is there a configuration option that allows the bot to return the original file path?
- If this is not fully possible without code, what is the minimal or no-code workaround?
Any guidance would be appreciated. Thanks!
Context
No response
Code Example (Optional)
Related Area
None
Before Asking
- [x] I have checked the documentation
Thanks for the question.
Current behavior: OpenViking can preserve the uploaded filename (for example original-file.pdf), but it does not automatically preserve the client's full local path such as /path/to/original-file.pdf. For local uploads, the server receives the file bytes and filename, not the user machine's absolute path.
There is no config option today that makes the bot automatically return the original local path or the original PDF path after conversion.
The simplest no-code workaround is to put that information into the resource target or description when adding the file:
add_resource(
path="/path/to/original-file.pdf",
to="viking://resources/uploads/original-file",
description="Original file: /path/to/original-file.pdf"
)
If the file has a stable remote URL, prefer adding that URL directly. That gives OpenViking a durable source reference the bot can cite.
Hi,
Thanks for the response and the workaround suggestions!
I tried implementing them but ran into a few roadblocks:
- The
add_resourceAPI doesn't actually have adescriptionparameter in its signature. - Passing the filepath via the
reasonorinstructionfields didn't work — the bot still can't recall the original path when asked. - Uploading via remote URL also didn't retain the original URL. The response JSON only shows temp paths (
source_path,temp_uri) with no trace of the remote source.
Two follow-up questions:
- If I embed the original filepath as metadata directly into the file itself, will it be preserved through the L0 Abstract and L1 Overview layers so the bot can still access and cite it?
- If custom code is needed, what's the recommended approach? I was thinking of uploading a companion JSON file alongside each resource that records the original source path — would that work, or is there a better pattern?
Thanks again for your help!
Thanks for the follow-up, and you are right.
First, I need to correct my previous suggestion: the Python/REST add_resource API does not have a description parameter. The available field is reason. The MCP tool has a description argument, but it is mapped internally to reason.
For your questions:
-
Embedding the original filepath inside the file itself may make it searchable, but it is not guaranteed to be preserved through L0 Abstract or L1 Overview. Those layers are generated summaries, not a metadata-preservation mechanism, so the model may omit the filepath if it does not consider it important. If you need reliable citation of the original path, do not rely on L0/L1 to carry it.
-
A companion JSON/Markdown manifest would work as a no-code workaround, especially if it is plain and explicit. For example, add a small file next to the resource:
# Source manifest
Resource: viking://resources/uploads/original-file
Original source path: /path/to/original-file.pdf
Original filename: original-file.pdf
Markdown is usually easier for retrieval than JSON. If custom code is acceptable, the better long-term pattern is first-class source metadata: add an original_source_path / source_url field during resource ingestion, persist it with the resource, and return it in search/chat citations. That is more reliable than using reason, instruction, or generated summaries.
Thanks for the question and for catching the incorrect description example earlier. For local uploads, the SDK sends the filename and file contents, not the client's absolute path. Converting the document cannot recover a local path that the server never received.
reason and instruction guide processing, and L0/L1 are generated summaries; none guarantees preservation of a source path for citations. Current URL ingestion carries the original URL as source information, but this does not automatically make a bot cite it or present the original PDF.
Closing this usage question with those boundaries clarified. Automatic original-file presentation and reliable source citations are additional capabilities, and we are not planning to add them under this issue.