MCPcopy Create free account
hub / github.com/hackmdio/codimd / isPdfUrl

Function isPdfUrl

public/js/utils.js:52–61  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

50
51// Check if URL is a PDF based on Content-Type header
52export async function isPdfUrl (url) {
53 try {
54 const response = await fetch(url, { method: 'HEAD' })
55 const contentType = response.headers.get('Content-Type')
56 return contentType === 'application/pdf'
57 } catch (error) {
58 console.warn('Error checking PDF content type:', error)
59 return false
60 }
61}

Callers 1

finishViewFunction · 0.90

Calls 1

getMethod · 0.80

Tested by

no test coverage detected