From f4ad7bde56b769cea0a2a26eb739e57500705555 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Fri, 12 Aug 2016 23:22:15 +0200 Subject: 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 --- application/NetscapeBookmarkUtils.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'application/NetscapeBookmarkUtils.php') 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 $filesize = $files['filetoupload']['size']; $data = file_get_contents($files['filetoupload']['tmp_name']); - // Sniff file type - if (! startsWith($data, '')) { + if (strpos($data, '') === false) { return self::importStatus($filename, $filesize); } -- cgit v1.2.3