A little safer and/or more dangerous way of checking content type

This commit is contained in:
Jackson Harper 2022-05-24 22:49:16 -07:00
parent a02bb2f5c9
commit 6869271d54

View file

@ -26,7 +26,7 @@ public struct PageScrapePayload {
// If the content type was specified and we know its PDF, use that
// otherwise fallback to using file extensions.
if let contentType = contentType, contentType == "application/pdf" {
if let contentType = contentType, contentType.contains("pdf") {
self.contentType = .pdf
} else {
self.contentType = url.hasSuffix(".pdf") ? .pdf : .html