Opened 10 years ago
Closed 10 years ago
#173 closed enhancement (fixed)
Try to detect content type of linked pages without loading entire file
| Reported by: | dstillman | Owned by: | dstillman |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | data layer | Version: | |
| Keywords: | Cc: | simon |
Description
Currently, if Scholar.Files.linkToFile() isn't provided with a title and mime type, it will fetch the entire file, which in the case of an 8MB PDF would be undesirable. Ideally we'd start the load and bail as soon as we had the title and content type figured out
Change History (1)
comment:1 Changed 10 years ago by dstillman
- Resolution set to fixed
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.
(In [448]) Closes #173, Try to detect content type of linked pages without loading entire file
Closes #174, Don't load images and attached files when detecting content type in linkFromURL()
If mime type not provided, Scholar.Files.linkFromURL() now uses XMLHTTPRequest HEAD request to get the content type without loading file (thanks Simon for the idea)
If title not provided, try to figure it out from URL, though not particularly intelligently (last slash)
Note that order of title and mimeType parameters is now swapped
This code should be a bit smarter about unexpected conditions