Opened 6 years ago

#1587 new defect

prototype.fixRelativeLinks causing a JSfault when the url is like example.com/folder/../folder2/image.png

Reported by: guest Owned by: gogo
Priority: normal Milestone:
Component: Xinha Core Version: trunk
Severity: major Keywords: fixRelativeLinks
Cc:

Description

Uncaught exception: TypeError: Cannot convert 'base_m' to object 
 Error thrown at

http://trac.xinha.org/browser/trunk/XinhaCore.js#L5924

CheckedPath?: http://www.example.com/folder/../folder2/image.png
localPath (where editor is right now): https://www.domain.tld/page.php

# base_m = b.match( relPath );
b = https://www.domain.tld/page.php
relPath = [RegExp] = new RegExp( "(.*?)(([^\/]*\/){"+ url_m.length+"})[^\/]*$" );

# url = src[i].match(/(src|href)="([^"]*)"/i); 
>>> url[0] 
 "src="http://www.example.com/folder/../folder2/image.png"" 
>>> url[1] 
 "src" 
>>> url[2] 
 "http://www.example.com/folder/../folder2/image.png" 
>>> url[3] 
 undefined

# url_m = url[2].match( /\.\.\//g );
>>> url_m[0] 
 "../" 
>>> url_m[1] 
 undefined

tl;dr;
local url mixed with remote url?

Change History (0)

Note: See TracTickets for help on using tickets.