Tags:
create new tag
, view all tags

Feature Proposals » SEARCH to handle ATTACHURL properly

Summary

Current State: Developer: Reason: Date: Concerns By: Bug Tracking: Proposed For:
MergedToCore HideyoImazu AcceptedByReleaseMeeting 2014-06-19   TWikibug:Item7528 KampalaRelease

Edit Form

TopicSummary:
CurrentState:
CommittedDeveloper:
ReasonForDecision:
DateOfCommitment:   Format: YYYY-MM-DD
ConcernRaisedBy:
BugTracking:
OutstandingIssues:
RelatedTopics:
InterestedParties:
ProposedFor:
TWikiContributors:
 

Motivation

The definition of ATTACHEDIMAGEFORMAT and ATTACHEDFILELINKFORMAT on TWikiPreferences looks awkward having %PUBURLPATH%/%WEB%/%TOPIC%.

If you check "Create a link to the attached file" on an Attach page, without setting ATTACHEDIMAGEFORMAT somewhere, you get the following HTML tag on the topic.

<img src="%PUBURLPATH%/%WEB%/%TOPIC%/tanita-lunch.jpg" alt="tanita-lunch.jpg" width="640" height="480" />
The above is awkward. This should be as follows.
<img src="%ATTACHURLPATH%/tanita-lunch.jpg" alt="tanita-lunch.jpg" width="640" height="480" />
The reason why ATTACHEDIMAGEFORMAT and ATTACHEDFILELINKFORMAT are defined using %PUBURLPATH%/%WEB%/%TOPIC% rather than %ATTACHURLPATH% is TWikibug:Item6903.

But defining ATTACHEDIMAGEFORMAT and ATTACHEDFILELINKFORMAT that way is not the right way. While SEARCH is being processed, ATTACHURLPATH and ATTACHURL are supposed to be processed under the same kind of care as WEB and TOPIC. This is because you cannot prevent users from putting %ATTACHURL%/filename.png manually.

Though TWikibug:Item6903 is talking about SEARCH in an INCLUDEd topic, this is a pure SEARCH issue. ATTACHURLPATH and ATTACHURL in an INCLUDEd topic don't cause the problem. Wihout INCLUDE, SEARCH{... format="$text"} causes the problem.

Right now TWiki::Search::_getTextAndMeta() treats WEB and TOPIC specially while ATTACHURLPATH and ATTACHURL are not treated specially.

Description and Documentation

  • enhance TWiki::Search::_getTextAndMeta() to treat %ATTACHURL% and %ATTACHURLPATH% properly
  • change the definition of ATTACHEDIMAGEFORMAT and ATTACHEDFILELINKFORMAT on TWikiPreferences so that they have %ATTACHURLPATH% instead of %PUBURLPATH%/%WEB%/%TOPIC%.

Examples

Impact

Implementation

-- Contributors: Hideyo Imazu - 2014-06-19

Discussion

Found the reason after some poking:

TWikibug:Item6903: Searching a topic that includes another topic that contains an image, breaks the image

-- Peter Thoeny - 2014-06-19

Now I understand the reason behind the ATTACHEDFILELINKFORMAT definition. But as discussed in KampalaReleaseMeeting2014x06x19, that definition is not the right way to alleviate the issue. While SEARCH is being processed, ATTACHURLPATH and ATTACHURL are supposed to be processed under the same kind of care as WEB and TOPIC. This is because you cannot prevent users from putting %ATTACHURL%/filename.png manually.

-- Hideyo Imazu - 2014-06-20

I set this to accepted by release meeting. Although we did not actually vote at the meeting, we had consensus how to fix it. Feel free to rename the topic and title to reflect this.

-- Peter Thoeny - 2014-06-20

Though TWikibug:Item6903 is talking about SEARCH in an INCLUDEd topic, this is a pure SEARCH issue. ATTACHURLPATH and ATTACHURL in an INCLUDEd topic don't cause the problem. Wihout INCLUDE, SEARCH{... format="$text"} causes the problem.

Right now TWiki::Search::_getTextAndMeta() treats WEB and TOPIC specially while ATTACHURLPATH and ATTACHURL are not treated specially.

As such, here's the actual proposal:

  • enhance TWiki::Search::_getTextAndMeta() to treat ATTACHURLPATH and ATTACHURL properly
  • get rid of the definition of ATTACHEDFILELINKFORMAT from TWikiPreferences

-- Hideyo Imazu - 2014-06-20

Why get rid of ATTACHEDFILELINKFORMAT? Someone might have a custom format defined.

-- Peter Thoeny - 2014-06-20

I plan to get rid of "Set ATTACHEDFIELDLINKFORMAT = ..." from TWikiPreferences. The code in TWiki::Attach referring to ATTACHEDFIELDLINKFORMAT will remain unchanged.

-- Hideyo Imazu - 2014-06-20

That means the setting will be an undocumented feature. Not too fond of this but I do not have a strong opinion on this.

-- Peter Thoeny - 2014-06-20

Peter, your point is taken. I've changed the proposal accordingly.

I've realize that this is not only about ATTACHEDFILELINKFORMAT but also about ATTACHEDIMAGEFORMAT. And the key is to enhance SEARCH. So I changed the topic name and topic summary accordingly.

-- Hideyo Imazu - 2014-06-23

Perfect!

-- Peter Thoeny - 2014-06-23

Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2014-06-26 - HideyoImazu
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.