Bug 32463 - When inserting the field (File name->File name), "[" become "%5B" and "]" become "%5D"
Summary: When inserting the field (File name->File name), "[" become "%5B" and "]" bec...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.3.0 RC1
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard:
Keywords: easyHack
Depends on:
Blocks:
 
Reported: 2010-12-16 23:12 UTC by spouilly
Modified: 2015-12-18 09:56 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
A first attempt at fixing this bug. (815 bytes, patch)
2010-12-29 15:03 UTC, Dan Corneanu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description spouilly 2010-12-16 23:12:02 UTC
I am using ubuntu 10.04 (i386), and the bug is present in both OpenOffice-3.2 and LibreOffice-3.3rc1

How to reproduce:
1. create a document named "test [en].odt"
2. inside the document, insert the field "File name" -> "File name"
3. the field displayed is "test %5Ben%5D.odt"

Note: there are no bugs for the other fields under "File name"
- "File name" -> "File name without extension" returns correctly "test [en]"
- "File name" -> "File name path" returns the correct path* "/home/xxx/Desktop"
- "File name" -> "Path/File name" returns the correct full path* "/home/xxx/Desktop/test [en].odt"

* even if the path contains "[" or "]"
Comment 1 Jan Holesovsky 2010-12-21 00:40:21 UTC
I suppose this might fit the 'EasyHacks' category - worth checking in the code, if it is only missing the conversion back from URL into a 'readable' filename.
Comment 2 Dan Corneanu 2010-12-29 15:03:22 UTC
Created attachment 41512 [details]
A first attempt at fixing this bug.

I have seen that all other fields eventually end up calling INetURLObject::decode with  INetURLObject::DECODE_WITH_CHARSET. I have changed the code to use  INetURLObject::DECODE_WITH_CHARSET for FF_NAME too. I have tested it and it works as expected.

A review will be appreciated.
Comment 3 Caolán McNamara 2011-01-04 11:28:32 UTC
Seems perfectly reasonable to me, especially given the behaviour of the field entry which returns the name without the suffix
Comment 4 Caolán McNamara 2011-01-04 12:29:16 UTC
Checked in your fix now, and added a cppunit test case in sw/qa/core for those SwFileNameFields
Comment 5 Rainer Bielefeld Retired 2012-04-10 03:04:19 UTC
EasyHack tags unification:  only allowed in Whiteboard to make queries more easy and reliable
Comment 6 Robinson Tryon (qubit) 2015-12-18 09:56:51 UTC
Migrating Whiteboard tags to Keywords: (EasyHack)
[NinjaEdit]