Ticket #749 (closed defect: fixed)

Opened 5 years ago

Last modified 4 years ago

IE: in ieCreatePath(), add handling for UNC paths containing "/"

Reported by: EricShulman Owned by: JeremyRuston
Priority: minor Milestone: 2.4.2
Component: core Version:
Severity: low Keywords:
Cc:

Description

(see  http://groups.google.com/group/TiddlyWiki/browse_frm/thread/93dd9a69cf0f20d4#)

In IE, various people are having problems saving TiddlyWiki to a UNC path (e.g. \\myserver\mydir\TiddlyWiki.html). As per Simon Huggins' investigation:

"It seems that Internet Explorer in its wisdom converts backslashes to
forward slashes for UNC paths, but not for local paths hence TiddlyWiki
wasn't finding the last slash in the path to strip off the filename to
leave the base path. This fix just searches for a forward slash if it
doesn't find a backslash."

This fallback behavior can *currently* be seen in the core code for saveEmpty() and getBackupPath(), so I think that making a similar change to ieCreatePath() seems very sensible and consistent. I don't see any downside to making this change...

Change History

Changed 5 years ago by EricShulman

  • milestone set to 2.5
function ieCreatePath(path)
{
	try {
		var fso = new ActiveXObject("Scripting.FileSystemObject");
	} catch(ex) {
		return null;
	}

	var pos = path.lastIndexOf("\\");
	if(pos==-1) pos=path.lastIndexOf("/");  // ADD THIS ONE LINE OF CODE!
	if(pos!=-1)
		path = path.substring(0,pos+1);

	var scan = [path];
	var parent = fso.GetParentFolderName(path);
	while(parent && !fso.FolderExists(parent)) {
		scan.push(parent);
		parent = fso.GetParentFolderName(parent);
	}

	for(i=scan.length-1;i>=0;i--) {
		if(!fso.FolderExists(scan[i])) {
			fso.CreateFolder(scan[i]);
		}
	}
	return true;
}

Changed 5 years ago by FND

  • status changed from new to closed
  • resolution set to fixed

Fixed in changeset:6486

Changed 4 years ago by MartinBudden

  • milestone changed from 2.5 to 2.4.2
Note: See TracTickets for help on using tickets.