TheBrusMeister / harviewer

Automatically exported from code.google.com/p/harviewer
0 stars 0 forks source link

problem loading local windows file with URL escaped characters #75

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
1. put file http%3A%2F%2Ffoo.rch.cm%2FlandingPage.html%3Fredirect%3D%2F.harp  
in folder in c:\tmp 

2. Open in browser (i use chrome) local har viewer with input url pointing to 
file defined in #1 (remember to URL encode file name):
file:///C:/test/harViewer/index.html?inputUrl=file://C:/tmp/http%253A%252F%252Ff
oo.rch.cm%252FlandingPage.html%253Fredirect%253D%252F.harp
(assuming that your harviewer is within C:/test/harViewer/)
3. you should observe:
   - constant Loading in harviewer text area.
   - error in network console: GET file:///C:/tmp/http%3A%2F%2Ffoo.rch.cm%2FlandingPage.html%3Fredirect%3D%2F.harp?callback=onInputData&_=1333105169973  status failed

After a short analysis it seems that i 

file:///C:/test/harViewer/index.html?inputUrl=file://C:/tmp/http%25253A%25252F%2
5252Ffoo.rch.cm%25252FlandingPage.html%25253Fredirect%25253D%25252F.harp

What is the expected output? What do you see instead?
no har is displayed

What version of the product are you using? On what operating system?
2.0.11

Please provide any additional information below.

We are generating html test report for our e2e tests. Within our test report 
file we have a link to local installed harviewer with an inputUrl to point to 
local stored harp files. Harp file names are like: 
"http%3A%2F%2Ffoo.rch.cm%2FlandingPage.html%3Fredirect%3D%2F.harp" 
 which reflects absolute URL location processed by URL encoder. Encoding is required to satisfy windows file system (need to escape special characters). 
So the final link to load harp is: 
file:///C:/test/harViewer/index.html?inputUrl=file://C:/tmp/http%253A%252F%252Ff
oo.rch.cm%252FlandingPage.html%253Fredirect%253D%252F.harp

Unfortunately these links do not work - no har view is displayed.

After a short investigation i found out i can manually make it work by tweaking 
a harviewer.js file. I set breakpoint on line:
 g = a.getURLParameters("inputUrl")
and after step over i executed g[0] = g[0].replace(/%/g,'%25').
So bascially i escaped % by %25. Then everything works as a charm

br Jakub

Original issue reported on code.google.com by jmilkiew...@gmail.com on 30 Mar 2012 at 12:27

Attachments:

GoogleCodeExporter commented 8 years ago
It seems that upload of file didn't work. So I am uploading it again.

Original comment by jmilkiew...@gmail.com on 30 Mar 2012 at 12:29

Attachments:

GoogleCodeExporter commented 8 years ago
The suggested fix doesn't seem to work for me.

But not sure if I am applying it well (there is no getURLParameters in 
harviewer.js files, but in harModel.js)

I am testing with this file name:
http%3A.harp

And I am always seeing: NetworkError: 403 Forbidden

Any other suggestions?

Honza

Original comment by odva...@gmail.com on 26 May 2012 at 6:17

GoogleCodeExporter commented 8 years ago
Hi

since i am not a js gut i managed to format minified version of harviewer from 
chrome. Indeed it seems that getUrlParamater lives in harPreview.js. If it 
happens that you see that function on harModel.js it is highly possible we are 
having a different versions of harviewer.

br Jakub

Original comment by jmilkiew...@gmail.com on 28 May 2012 at 9:45

GoogleCodeExporter commented 8 years ago
Yep, the latest is 2.0.15 here:
http://www.softwareishard.com/har/viewer/

The source code is here:
https://github.com/janodvarko/harviewer

Can you check your patch?

Honza

Original comment by odva...@gmail.com on 28 May 2012 at 1:35