[VD] Check file protocol using file format 25/225625/3
authorliwei <wei90727.li@samsung.com>
Fri, 21 Feb 2020 07:39:05 +0000 (15:39 +0800)
committerliwei <wei90727.li@samsung.com>
Mon, 24 Feb 2020 01:39:56 +0000 (09:39 +0800)
In current logic, WRT use url format to check file protocol, if
file path including special character(ex. blank/?/+/...), it will
be converted to special code(blank-> %20, #->%23,...), so we should
use file format to check file exist or not.

ex.
/opt/media/USBDriveA1/bts/1/Fulfill%20mentGustav_Klimt.jpg we should
change it to file format
/opt/media/USBDriveA1/bts/1/Fulfill mentGustav_Klimt.jpg
otherwise, this image can not be shown.

Change-Id: I6f3fbc6304ab8ea501f7cd01aa5f05f16edd779a
Signed-off-by: liwei <wei90727.li@samsung.com>
wrt_app/src/web_application.js

index 54290507579bbc8bb491d2d0360d8e61030ca8a3..5cfafa0c1fd3de685bfd5f50c78ea97e06fcb9a1 100755 (executable)
@@ -146,7 +146,7 @@ class WebApplication {
             protocol.interceptFileProtocol('file', (request, callback) => {
                 if (request.url) {
                     let access_path, parsed_info = new URL(request.url);
-                    access_path = parsed_info.host + parsed_info.pathname;
+                    access_path = parsed_info.host + decodeURI(parsed_info.pathname);
                     console.log(`check path: : ${access_path}`);
                     for (let p in self.accessiblePath) {
                         if (access_path.startsWith(self.accessiblePath[p])) {