forked from jgm/pandoc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix handling of
file:
URL scheme in downloadOrRead
move up the pattern match to be reachable, closes jgm#5517
- Loading branch information
Showing
2 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Use epub output to trigger `downloadOrRead` in `Text.Pandoc.Class` | ||
in order to test `file:` URL-scheme handling. | ||
|
||
There are no relative `file:` URLs, so we cannot | ||
test with an actual file, since we don't know the | ||
current working directory. Instead, we redirect | ||
stderr to stdout and check for the correct warning. | ||
|
||
``` | ||
% pandoc -M title=test -f native -t epub -o /dev/null 2>&1 | ||
[Para [Image ("",[],[]) [] ("file:/testpath/foo.jpg","")]] | ||
^D | ||
[WARNING] Could not fetch resource 'file:/testpath/foo.jpg': PandocIOError "/testpath/foo.jpg" /testpath/foo.jpg: openBinaryFile: does not exist (No such file or directory) | ||
``` | ||
|
||
``` | ||
% pandoc -M title=test -f native -t epub -o /dev/null 2>&1 | ||
[Para [Image ("",[],[]) [] ("file:///testpath/foo.jpg","")]] | ||
^D | ||
[WARNING] Could not fetch resource 'file:///testpath/foo.jpg': PandocIOError "/testpath/foo.jpg" /testpath/foo.jpg: openBinaryFile: does not exist (No such file or directory) | ||
``` | ||
|
||
``` | ||
% pandoc -M title=test -f native -t epub -o /dev/null 2>&1 | ||
[Para [Image ("",[],[]) [] ("file://localhost/testpath/foo.jpg","")]] | ||
^D | ||
[WARNING] Could not fetch resource 'file://localhost/testpath/foo.jpg': PandocIOError "/testpath/foo.jpg" /testpath/foo.jpg: openBinaryFile: does not exist (No such file or directory) | ||
``` |