A plugin for Obsidian (https://obsidian.md) that adds additional `x-callback-url` endpoints to the app for common actions — it's a clean, super-charged addition to Obsidian URI.
When a new URL request comes in, the request parameters are validated via zod schemas. If they "fit" a schema, the relevant route handler is called. Otherwise, only an error toast is displayed in Obsidian, and since we're dealing with a malformed request, the x-error callback won't be triggered. This is by design: bad request, tough luck.
With the introduction of zodExistingFilePath and zodExistingFolderPath this starts to become a problem, however, because now the request validation of some routes hinges on (for example) the file parameter referencing an existing file. If the referenced file is 404, the validation fails.
I'd like to keep the file reference validation, so I'll need to find a way to send out x-error callbacks even for malformed requests.
Idea: if the malformed request contains and x-error parameter, honor it instead of just backing off right away.
When a new URL request comes in, the request parameters are validated via zod schemas. If they "fit" a schema, the relevant route handler is called. Otherwise, only an error toast is displayed in Obsidian, and since we're dealing with a malformed request, the
x-error
callback won't be triggered. This is by design: bad request, tough luck.With the introduction of
zodExistingFilePath
andzodExistingFolderPath
this starts to become a problem, however, because now the request validation of some routes hinges on (for example) thefile
parameter referencing an existing file. If the referenced file is 404, the validation fails.I'd like to keep the file reference validation, so I'll need to find a way to send out
x-error
callbacks even for malformed requests.Idea: if the malformed request contains and
x-error
parameter, honor it instead of just backing off right away.ZCO-135