diff options
author | VirtualTam <virtualtam@flibidi.net> | 2016-08-12 23:22:15 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-11-05 14:29:52 +0100 |
commit | c019d62970a5b618f44ac858b990b573645bd714 (patch) | |
tree | 789bb2047f008993f08b3854855d01aeeb67decf /application | |
parent | 24d8f65abea2c1251e250089f20e89034454926d (diff) | |
download | Shaarli-c019d62970a5b618f44ac858b990b573645bd714.tar.gz Shaarli-c019d62970a5b618f44ac858b990b573645bd714.tar.zst Shaarli-c019d62970a5b618f44ac858b990b573645bd714.zip |
Fix: ensure Internet Explorer bookmark dumps can be imported
Relates to https://github.com/shaarli/Shaarli/issues/607
Modifications:
- [application][tests] NetscapeBookmarkUtils: more permissive doctype detection
The IE bookmark exports contain extra escape sequences, which can be observed
by binary comparison of the reference input data used in tests:
$ cmp -b -l -n 8 netscape_basic.htm internet_explorer_encoding.htm
1 74 < 357 M-o
2 41 ! 273 M-;
3 104 D 277 M-?
4 117 O 74 <
5 103 C 41 !
6 124 T 104 D
7 131 Y 117 O
8 120 P 103 C
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'application')
-rw-r--r-- | application/NetscapeBookmarkUtils.php | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/application/NetscapeBookmarkUtils.php b/application/NetscapeBookmarkUtils.php index b99a432e..c3181254 100644 --- a/application/NetscapeBookmarkUtils.php +++ b/application/NetscapeBookmarkUtils.php | |||
@@ -98,8 +98,7 @@ class NetscapeBookmarkUtils | |||
98 | $filesize = $files['filetoupload']['size']; | 98 | $filesize = $files['filetoupload']['size']; |
99 | $data = file_get_contents($files['filetoupload']['tmp_name']); | 99 | $data = file_get_contents($files['filetoupload']['tmp_name']); |
100 | 100 | ||
101 | // Sniff file type | 101 | if (strpos($data, '<!DOCTYPE NETSCAPE-Bookmark-file-1>') === false) { |
102 | if (! startsWith($data, '<!DOCTYPE NETSCAPE-Bookmark-file-1>')) { | ||
103 | return self::importStatus($filename, $filesize); | 102 | return self::importStatus($filename, $filesize); |
104 | } | 103 | } |
105 | 104 | ||