Tags:
create new tag
, view all tags

Bug: Raw view has tab instead of sets of 3 spaces

When a topic is stored sets of 3 spaces at the start of each line are converted to tabs. When the user edits they are converted back. When using ?raw=on users expect to see the same text the get when editing, so raw should also convert to spaces.

Test case

Create a topic with a line with 3 spaces then " * a bullet". Save and use more to get raw view - you'll see a tab at the start of the line.

Environment

TWiki version:  
TWiki plugins:  
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  

-- JohnTalintyre - 28 May 2002

Follow up

Fix record

Here is the patch, which adds 2 lines like the following to bin/view : NoTabsInRawView.patch

      $text =~ s/\t/   /go;

-- ColasNahaboo - 28 May 2002

Thanks for reporting this. It needs to be fixed. Though it is not that serious since tabs will be converted when you save and reload the topic.

A more serious problem is that the raw view strips out <nop>, and that HTML entities like &lt; are expanded. That means text gets altered in away that you cannot simply do a copy & paste to recover from a previous release.

Test Case: This WebNotify topic is escaped by <nop>.

-- PeterThoeny - 28 May 2002

This is now fixed, in TWikiAlphaRelease and at TWiki.org:

Index: view
===================================================================
RCS file: /cvsroot/twiki/twiki/bin/view,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -r1.57 -r1.58
*** view        5 Jan 2003 02:38:11 -0000       1.57
--- view        5 Jan 2003 09:19:17 -0000       1.58
***************
*** 153,156 ****
--- 153,160 ----
        my $vtext = "<form><textarea readonly=\"readonly\" wrap=\"virtual\"
rows=\"%EDITBOXHEIGHT%\" cols=\"%EDITBOXWIDTH%\">";
        $vtext = &TWiki::handleCommonTags( $vtext, $topic );
+         $text =~ s/&/&<nop>amp\;/go;
+         $text =~ s/</&<nop>lt\;/go;
+         $text =~ s/>/&<nop>gt\;/go;
+         $text =~ s/\t/   /go;
        $text = "$vtext$text</textarea></form>";
        if( $viewRaw !~ /debug/i ) {

-- PeterThoeny - 05 Jan 2003

Ok, I added another patch NoTabsInRawView2.patch for people wanting this also on their stable release...

-- ColasNahaboo - 06 Jan 2003

Topic attachments
I Attachment Action Size Date Who Comment
Unknown file formatpatch NoTabsInRawView.patch manage 0.8 K 2002-05-28 - 12:24 ColasNahaboo patch to bin/view of Dec 2001 release
Unknown file formatpatch NoTabsInRawView2.patch manage 0.9 K 2003-01-06 - 14:48 ColasNahaboo additional patch for < > &, for Dec 2001 release
Topic revision: r5 - 2003-01-06 - ColasNahaboo
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.