fix(scanner): accept Epson inbox GET preflight
This commit is contained in:
@@ -30,8 +30,12 @@ export default async function scannerInboxGateway(server: FastifyInstance, optio
|
||||
if (filename && (filename.length > 200 || filename.startsWith(".") || /[\\/\u0000-\u001f\u007f]/.test(filename))) {
|
||||
throw scannerError(400, "Unterordner und ungültige Dateinamen werden nicht unterstützt.")
|
||||
}
|
||||
if (req.method === "OPTIONS") return reply.header("DAV", "1").header("Allow", methods).code(200).send()
|
||||
if (req.method === "MKCOL") return reply.header("Allow", methods).code(filename ? 403 : 405).send()
|
||||
const allowedMethods = filename ? methods : `${methods}, GET`
|
||||
if (req.method === "OPTIONS") return reply.header("DAV", "1").header("Allow", allowedMethods).code(200).send()
|
||||
if (req.method === "MKCOL") return reply.header("Allow", allowedMethods).code(filename ? 403 : 405).send()
|
||||
// ES-580W checks authentication with GET before WebDAV discovery or uploading.
|
||||
// Confirm only the collection itself; never return a listing or document content.
|
||||
if (req.method === "GET" && !filename) return reply.header("DAV", "1").code(200).send()
|
||||
if (req.method === "PUT") {
|
||||
if (!filename) throw scannerError(400, "Ein Dateiname ist erforderlich.")
|
||||
if (req.headers["content-range"]) throw scannerError(400, "Bitte die vollständige Datei übertragen.")
|
||||
@@ -62,7 +66,7 @@ export default async function scannerInboxGateway(server: FastifyInstance, optio
|
||||
return reply.header("DAV", "1").type("application/xml; charset=utf-8").code(207).send(
|
||||
`<?xml version="1.0" encoding="utf-8"?><d:multistatus xmlns:d="DAV:"><d:response><d:href>${escapeXml(href)}</d:href><d:propstat><d:prop><d:displayname>${escapeXml(filename || "FEDEO Dokumentenablage")}</d:displayname>${props}</d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response></d:multistatus>`)
|
||||
}
|
||||
return reply.header("Allow", methods).code(405).send()
|
||||
return reply.header("Allow", allowedMethods).code(405).send()
|
||||
}
|
||||
|
||||
// Both slash forms work without redirects (some scanners discard authentication on redirects).
|
||||
|
||||
Reference in New Issue
Block a user