FileDropPlugin links on hosted TW

57 views
Skip to first unread message

Shango

unread,
May 21, 2015, 8:29:53 AM5/21/15
to tiddl...@googlegroups.com
This is for Classic TiddlyWiki version 2.8.1 to be specific.  I have a bunch of tiddlers that link to pictures, media, etc. They were created using the FileDrop Plugin.  I mainly use a local TW for myself only.  Then I decided to export a few tiddlers into another TW and host it on a NAS for people to connect to and view.  I noticed that all the links on the NAS's TW were broken.  I discovered that the links were using the backslash "\" so I changed them to regular slashes "/" and that cleared the problem and the links now work.  It seems like something is different about how the TW is being served up on the NAS that it doesn't like the backslashes for links.  I'd like to change the behavior of the FileDrop Plugin so that it generates the links with regular slashes as opposed to backslashes but it seems to be hard coded into the javascript.  I don't know enough about it to change it myself.  Can anyone help me with this?  Thanks.

Eric Shulman

unread,
May 21, 2015, 11:53:04 AM5/21/15
to tiddl...@googlegroups.com
On Thursday, May 21, 2015 at 5:29:53 AM UTC-7, Shango wrote:
This is for Classic TiddlyWiki version 2.8.1 to be specific.  I have a bunch of tiddlers that link to pictures, media, etc. They were created using the FileDrop Plugin.  I mainly use a local TW for myself only.  Then I decided to export a few tiddlers into another TW and host it on a NAS for people to connect to and view.  I noticed that all the links on the NAS's TW were broken.  I discovered that the links were using the backslash "\" so I changed them to regular slashes "/" and that cleared the problem and the links now work.  It seems like something is different about how the TW is being served up on the NAS that it doesn't like the backslashes for links.  I'd like to change the behavior of the FileDrop Plugin so that it generates the links with regular slashes as opposed to backslashes but it seems to be hard coded into the javascript.  I don't know enough about it to change it myself.  Can anyone help me with this?  Thanks.

The code in that plugin already converts all "\" to "/", so I'm not sure why your attachements have "\" in them.

Also. unless you are using a very old copy of FireFox, FileDropPlugin no longer works, because it requires
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
which is no longer supported by the browser.

Thus, there is nothing to fix, since the plugin will not work anyway.

Sorry.

enjoy,
-e
Eric Shulman
ELS Design Studios
TiddlyTools - "Small Tools for Big Ideas!"
InsideTiddlyWiki: The Missing Manuals

YOUR DONATIONS ARE VERY IMPORTANT!
HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:




Shango

unread,
May 21, 2015, 1:53:44 PM5/21/15
to tiddl...@googlegroups.com
I'm using version 2.1.4 of the plugin and I just copied the code into my TW and refreshed just to make sure.  It is with the %3 (relative path) parameter that it is putting in backslashes to delimit the folders.  If it is supposed to replace the backslashes with forward slashes, is it supposed to do that with the relative path also?  I am using FF Portable 3.6 Legacy to run TW classic. 

Shango

unread,
May 21, 2015, 2:37:57 PM5/21/15
to tiddl...@googlegroups.com
OK I think I figured it out and I can see the code for replacing the backslahes -- path.replace(/\\/g,'/');
But it is only doing it for when its assigning the URL parameter.  I had to add these two lines:
        var relpath=relpath.replace(/\\/g,'/');                                              // added line
        var path=path.replace(/\\/g,'/');                                                  // added line

Hopefully I didn't break anything but it seems to be working correctly now. 



On Thursday, May 21, 2015 at 11:53:04 AM UTC-4, Eric Shulman wrote:

Eric Shulman

unread,
May 21, 2015, 3:08:31 PM5/21/15
to tiddl...@googlegroups.com
On Thursday, May 21, 2015 at 11:37:57 AM UTC-7, Shango wrote:
OK I think I figured it out and I can see the code for replacing the backslahes -- path.replace(/\\/g,'/');
But it is only doing it for when its assigning the URL parameter.  I had to add these two lines:
        var relpath=relpath.replace(/\\/g,'/');                                              // added line
        var path=path.replace(/\\/g,'/');                                                  // added line

Hopefully I didn't break anything but it seems to be working correctly now.

After your follow-up message, I took another look through my code, specifically looking at the "DropLink" handling, which uses "path" and "relpath".

Your fix is pretty much what I was going to recommend.  However, changing the slashes in the path variable *might* break dropping of file *content* or creating of attachment tiddlers.  That's why you see a lot of "path.replace(/\\/g,'/')" usage in the code.  It ensures that the fixup for "path" doesn't break any other logic that relies on the unaltered value.

I suggest that you leave the contents of the path and relpath variables unchanged, but fixup the backslashes on *output* only, by changing this line:
if (co.chkFileDropLink) txt+=fmt.format([name,url,path,relpath,size,when,now,who]);
to
if (co.chkFileDropLink) txt+=fmt.format([name,url,path.replace(/\\/g,'/'),relpath.replace(/\\/g,'/'),size,when,now,who]);
That should fix your problem without affecting anything else.

Shango

unread,
May 21, 2015, 5:26:16 PM5/21/15
to tiddl...@googlegroups.com
Thank you very much!!
Reply all
Reply to author
Forward
0 new messages