Open
Description
Describe the bug
Using JS and dotprompt files, I have the following:
{{media url=screenshot contentType=contentType}}
If the screenshot
variable has a space in it (e.g. gs://MY-BUCKET/test/this and that.png
, it return with an error like this:
{"error":{"code":400,"message":"Unable to submit request because it has a mimeType parameter with value and, which is not supported. Update the mimeType and try again. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini","status":"INVALID_ARGUMENT"}}
Where and
is the 2nd word of the filename. It works as expected with this prompt, where the contentType is not dynamic:
{{media url=screenshot contentType="image/png"}}
I've tried to URL encode the screenshot
URL:
const uploadUrl = `gs://${bucketName}/${encodeURIComponent(input.path).replaceAll("%2F", "/")}`;
This does not work and gives 404 errors:
ClientError: [VertexAI.ClientError]: got status: 404 Not Found. {"error":{"code":404,"message":"No such object: BUCKET_NAME/tasks/xxxxx-test/3m-mega-task/submission/XX%20Product%20list.docx.pdf","status":"NOT_FOUND"}}
Expected behavior
I should be able to dynamically pass the contentType to files with spaces in them. At the moment I'm working around by having several dotPrompt files for each anticipated contentType.
Runtime (please complete the following information):
- OS: Linux
- Genkit: 1.9.0
Node version
- v22.15.1
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status