You are here: Foswiki>Tasks Web>Item10436 (21 Dec 2014, GeorgeClark)Edit Attach

Item10436: Renaming a Web only is updating the references link that are located in topics within that web. So the reference link in other webs or subwebs are not updated

pencil
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: Render
Branches:
Reported By: JuanPabloGaviria
Waiting For:
Last Change By: GeorgeClark
Hi,

I my foswiki has around 210 webs(including subwebs) and i have links from topic in a web to other topic in other web or subweb, so when i try to rename a web or subweb, the rename form only show me the references link that are in the same web. Example:

  1. I have a web name One.
  2. And other name Two
  3. Create 1 topic for each web name TopicOne and TopicTwo, respectively.
  4. Create a link for TopicOne in TopicTwo.
  5. Then try to rename the web One.
    • I spect that the rename form show me the TopicTwo in the list of references topics to be updated, but it doesn't
  6. Rename the web
  7. go to view the TopicTwo and the link is broken.

So, i have to look in to the foswiki code to find the bug and i found two errors:
  • When the rename script is excuted, it calls Foswiki/Render.pm getReferenceRE to create a regex string to search the references link in others webs, line 2150:
....
           if ( $options{interweb} ) {

                # web name used to refer to a topic
                $re =
                    $bow . '\.'
                  . $matchWeb
                  . '(\.[$Foswiki::regex{mixedAlphaNum}]+)'
                  . $eow;

            }
            else {

                # most general search for a reference to a topic or subweb
                # note that replaceWebReferences() uses $1 from this regex
                $re =
                    $bow
                  . $matchWeb
                  . "(([\/\.][$Foswiki::regex{upperAlpha}][$Foswiki::regex{mixedAlphaNum}_]*)*"
                  . "\.[$Foswiki::regex{mixedAlphaNum}]+)"
                  . $eow;
            }
  • The first thing is when the if statement is true, the $re is not correct, because use $Foswiki::regex{mixedAlphaNum} between single coute(') and perl take it as text. so it has to be chage like this: . "(\.[$Foswiki::regex{mixedAlphaNum}]+)"

  • But whit this regex crash, so i have to change it(maybe you can make it better, i just use the same regex that use the else), so finaly the code looks like this:
....
           if ( $options{interweb} ) {

                # web name used to refer to a topic
                $re =
                    $bow
                  . $matchWeb
                  . "(([\/\.][$Foswiki::regex{upperAlpha}][$Foswiki::regex{mixedAlphaNum}_]*)*"
                  . "\.[$Foswiki::regex{mixedAlphaNum}]+)"
                  . $eow;
            }
            else {

                # most general search for a reference to a topic or subweb
                # note that replaceWebReferences() uses $1 from this regex
                $re =
                    $bow
                  . $matchWeb
                  . "(([\/\.][$Foswiki::regex{upperAlpha}][$Foswiki::regex{mixedAlphaNum}_]*)*"
                  . "\.[$Foswiki::regex{mixedAlphaNum}]+)"
                  . $eow;
            }

If you have a better solution plaese, post it.

-- JuanPabloGaviria - 02 Mar 2011

Thanks for the proposed fix. This code has changed significantly in 1.1 and the error described is no longer in the code. Please upgrade to 1.1.2 (or 1.1.3 which should be released very soon now).

-- GeorgeClark - 03 Mar 2011

Changing this to no action. No feedback reported in recent releases.

-- GeorgeClark - 21 Dec 2014
 

ItemTemplate edit

Summary Renaming a Web only is updating the references link that are located in topics within that web. So the reference link in other webs or subwebs are not updated
ReportedBy JuanPabloGaviria
Codebase 1.0.9
SVN Range
AppliesTo Engine
Component Render
Priority Normal
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release01x01Checkins
Topic revision: r3 - 21 Dec 2014, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy