Modify

Opened 6 years ago

Last modified 4 years ago

#3931 new defect

Doesn't work because of double slashes in URLs

Reported by: martin_s Owned by: lcordier
Priority: normal Component: FreemindMacro
Severity: minor Keywords: double slash link
Cc: Trac Release: 0.11

Description

I installed it under Trac 0.11.2 and it seems not to work properly, at least not with Firefox 3.0.3 under Ubuntu Hardy.

The flash itself is starting but the Freemind viewer isn't loading.
I checked the resulting source code (after the Javascript does it's work) with the Firebug plugin for Firefox and I found that all links start with a double slash '//', i.e. the SWF is linked to //chrome/freemind/swf/visorFreemind.swf, but also all other URLs like the one for the actual Freemind file, the CSS file, etc.

After removing the second slash with the Firebug edit function the visorFreemind is finally loading, but without loading the mindmap (which seems to be an other issue).

Attachments (0)

Change History (18)

comment:1 Changed 6 years ago by martin_s

Just to clarify:

After removing the second slash with the Firebug edit function the visorFreemind is finally
loading, but without loading the mindmap (which seems to be an other issue).

I had a typo in the mindmap filename. With the correct filename the mindmap is loading after the double slashes are removed using Firebug edit.

comment:2 Changed 6 years ago by lcordier

Can you please svn up and give me debug ouput for your setup. Just add the parameter debug
to your macro string like so:

[[Freemind(htdocs://site/filename.mm,debug)]]

Cut and paste me the output.

comment:3 Changed 6 years ago by lcordier

I just tested it on my (Ubunutu Hardy, Firefox 3.0.1) with Firebug 1.2.1 and [4523] and everything seems fine to me.

comment:4 Changed 6 years ago by martin_s

I will test it as soon I find time.

One reason for this issue could be that you ask for two slashes in the URL, e.g.

attachment://.../filename.mm,

but the actual TracLinks syntax is without the slashes:

attachment:../filename.mm.

Only sources links can have one leading slash, e.g.

source:/trunk/../filename.mm.

Also in source:freemindmacro/0.11/freemind/macro.py you use double slashes htdocs://freemind/css/flashfreemind.css, just try it with htdocs:freemind/css/flashfreemind.css, etc.

comment:5 Changed 5 years ago by lcordier

My code didn't use TracLinks, instead it used proper URLs with different schemes:

htdocs://
source://
ticket://
wiki://

TracLinks htdocs: references the site's htdocs, I am not sure if it will properly reference the plugin's htdocs. Anyway I have now added [4544] TracLinks as to your request #3938. Hope this helps.

By the way, I would very much appreciate if you can give me some debug output. Just add the
parameter 'debug' to your call.

[Freemind(htdocs://filename.mm,debug)]

comment:6 Changed 5 years ago by anonymous

Hi,

I have the same problem using trac 0.11.2:

Using the following macros:

[[Freemind(source://workbase/mindmaps/misc_map.mm)]]

[[Freemind(htdocs://site/misc_map.mm)]]

[[Freemind(source://workbase/mindmaps/misc_map.mm,debug)]]

[[Freemind(htdocs://site/misc_map.mm,debug)]]

The one from svn does not work, whereas the htdocs work.

I have set the freemind mime-type property on svn.

FreemindMacro Debug Log
=======================

time: 20081128T144825Z
version: 4559
content: source://workbase/mindmaps/misc_map.mm,debug
args: [u'source://workbase/mindmaps/misc_map.mm', u'debug']
kwargs: {}
formatter.href.base: /x/trac
script: 

            $(document).ready(function() {
                $("#flashcontent03").mouseover(function() {
                    document.visorFreeMind03.focus();
                });
            });
        

FreemindMacro Debug Log
=======================

time: 20081128T144825Z
version: 4559
content: htdocs://site/misc_map.mm,debug
args: [u'htdocs://site/misc_map.mm', u'debug']
kwargs: {}
formatter.href.base: /x/trac
script: 

            $(document).ready(function() {
                $("#flashcontent04").mouseover(function() {
                    document.visorFreeMind04.focus();
                });
            });

comment:7 Changed 5 years ago by lcordier

I removed most of the useful stuff from the debug info when I "fixed" this problem previously ;)
Please check out the latest code and give me the debug output again. It should show me the generated URL to the file in source.

comment:8 Changed 5 years ago by anonymous

Ok,

The first debug with source:// prefix also does not work for freemind version source:/freemindmacro/0.11/@4890

[[Freemind(source://workbase/mindmaps/misc_map.mm,debug)]]

Output:

FreemindMacro Debug Log
=======================

time: 20081130T144557Z
version: 4890
content: source://workbase/mindmaps/misc_map.mm,debug
args: [u'source://workbase/mindmaps/misc_map.mm', u'debug']
kwargs: {}
formatter.href.base: /x/trac
script: 

            $(document).ready(function() {
                $("#flashcontent03").mouseover(function() {
                    document.visorFreeMind03.focus();
                });
            });
            
            // url: /x/trac/export/workbase/mindmaps/misc_map.mm
            // base: /x/trac/export/workbase/mindmaps/


with

[[Freemind(htdocs://site/misc_map.mm,debug)]]

works and gives this:

FreemindMacro Debug Log
=======================

time: 20081130T144557Z
version: 4890
content: htdocs://site/misc_map.mm,debug
args: [u'htdocs://site/misc_map.mm', u'debug']
kwargs: {}
formatter.href.base: /x/trac
script: 

            $(document).ready(function() {
                $("#flashcontent04").mouseover(function() {
                    document.visorFreeMind04.focus();
                });
            });
            
            // url: /x/trac/chrome/site/misc_map.mm
            // base: /x/trac/chrome/site/


  • Thanx -

comment:9 Changed 5 years ago by lcordier

I forgot to ask could you also actually give me the full path to the mm file in your SVN via trac.
Use the 'Browse Source' button in trac navigation, browse to your file, view it, then copy & paste the 'Original Format' link (at the bottom of the page).

Do you use a single/multiple project(s) trac installation?

comment:10 Changed 5 years ago by renzo

The Trac Browser URL is:

https://myhost.org/x/trac/export/13/workbase/mindmaps/misc_map.mm

so the 13 is the actual revision number which makes the difference to the URL you are constructing...

And it is a single project installation.

Tnx for your efforts.

I have several people who would use the freemind macro, if it also can do it from versioned mindmaps.

comment:11 Changed 5 years ago by lcordier

If you removed the 13 from the URL is should access the HEAD revision. But if you
deliberately want to access a specific version, you can as listed in the examples. Try:

[[Freemind(source://13/workbase/mindmaps/misc_map.mm)]]

That should access revision 13 of the file. My problem is why it is not is not working with the
HEAD revision. First try that for now, then I can maybe later update the debug output to include more information.

Regards, Louis.

comment:12 follow-up: Changed 5 years ago by xyanipheia

intersting for me was, that using source://path/to/file.mm did not work, but using a revison number worked. I also tried using HEAD instead of a number and it worked, too. At least this is a workaround.

My configuration:

Windows+Apache-2.2.9+SVN1.5.5+Python-2.5+TRAC-0.11.2.1

comment:13 in reply to: ↑ 12 Changed 5 years ago by renzo

  • Severity changed from major to minor

Replying to xyanipheia:

intersting for me was, that using source://path/to/file.mm did not work, but using a revison number worked. I also tried using HEAD instead of a number and it worked, too. At least this is a workaround.

Yes! That works for me too. Thx.

It is also documented here. Still it would be better, if no specific source revision is specified, it would take the head revision automagically. Now, that there is a reasonable workaround we can decrease the Severity...

comment:14 follow-up: Changed 5 years ago by anonymous

  • tracd 0.11.5
  • FreemindMacro-0.1-py2.6.egg
  • TRACENV/htdocs/index.mm
[[Freemind(htdocs:index.mm,debug)]]
[[Freemind(htdocs://site/index.mm,debug)]]
FreemindMacro Debug Log
=======================

time: 20090915T115011Z
version: 4890
content: htdocs:index.mm,debug
args: [u'htdocs:index.mm', u'debug']
kwargs: {}
formatter.href.base: 
script: 

            $(document).ready(function() {
                $("#flashcontent03").mouseover(function() {
                    document.visorFreeMind03.focus();
                });
            });
            
            // url: /chrome/site/index.mm
            // base: /chrome/site/
            
            
        

FreemindMacro Debug Log
=======================

time: 20090915T115011Z
version: 4890
content: htdocs://site/index.mm,debug
args: [u'htdocs://site/index.mm', u'debug']
kwargs: {}
formatter.href.base: 
script: 

            $(document).ready(function() {
                $("#flashcontent04").mouseover(function() {
                    document.visorFreeMind04.focus();
                });
            });
            
            // url: //chrome/site/index.mm
            // base: //chrome/site/
{{{
<embed id="visorFreeMind01" align="middle" width="100%" height="100%" type="application/x-shockwave-flash" quality="high" bgcolor="#ffffff" flashvars="openUrl=_blank&min_alpha_buttons=20&initLoadFile=/chrome/site/index.mm&max_alpha_buttons=100&defaultToolTipWordWrap=200&startCollapsedToLevel=3&baseImagePath=/chrome/site/" src="//chrome/freemind/swf/visorFreemind.swf" wmode="opaque"/>

<embed id="visorFreeMind02" align="middle" width="100%" height="100%" type="application/x-shockwave-flash" quality="high" bgcolor="#ffffff" flashvars="openUrl=_blank&min_alpha_buttons=20&initLoadFile=//chrome/site/index.mm&max_alpha_buttons=100&defaultToolTipWordWrap=200&startCollapsedToLevel=3&baseImagePath=//chrome/site/" src="//chrome/freemind/swf/visorFreemind.swf" wmode="opaque"/>
}}}

strange path is generated. 

{{{
src="//chrome/freemind/swf/visorFreemind.swf"
}}}

comment:15 in reply to: ↑ 14 ; follow-ups: Changed 5 years ago by anonymous

Replying to anonymous:

--- macro.py    2009-09-15 21:23:02.000000000 +0900
+++ macro.py.dist       2009-09-15 21:22:22.000000000 +0900
@@ -60,7 +60,7 @@
         """ Remove double slashes.
         """
         parts = [part.strip('/') for part in parts]
-        return '' + '/'.join(parts)
+        return '/' + '/'.join(parts)
     
     # You must supply a formatter or a base.
     if not base:

seems to work for me.

comment:16 in reply to: ↑ 15 Changed 5 years ago by lcordier

Replying to anonymous:

Replying to anonymous:

  • return + '/'.join(parts)

+ return '/' + '/'.join(parts)
seems to work for me.

The added line is already in the code. Did you do the diff the right way around? I think if I remove the first '/' it will not be an absolute URL anymore and break the code for other users.

comment:17 in reply to: ↑ 15 Changed 5 years ago by anonymous

Replying to anonymous:

         parts = [part.strip('/') for part in parts]
-        return '' + '/'.join(parts)
+        return '/' + '/'.join(parts)

Ooops formatting. Do you mean to remove the first '/'. That will most likely break it for other users.

comment:18 Changed 4 years ago by r_herrma@…

If formatter.href.base is an empty string, the url will also have double slashes.
The following will fix it:

--- freemind/macro.py   (Revision 6903)
+++ freemind/macro.py   (Arbeitskopie)
@@ -60,6 +60,7 @@
         """ Remove double slashes.
         """
         parts = [part.strip('/') for part in parts]
+        parts.remove('')
         return '/' + '/'.join(parts)

     # You must supply a formatter or a base.

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.