codingEcho / thumbnailator

Automatically exported from code.google.com/p/thumbnailator
Other
0 stars 0 forks source link

Wrong rename (asFiles) for output #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using ".asFiles(Rename.SUFFIX_DOT_THUMBNAIL)"
2. On files which has a "." in the file name.
3. Example: "orig.image.jpg"
4. Will produce: "orig.thumbnail.image.jpg"
5. Instead of the desired output: "orig.image.thumbnail.jpg"

What is the expected output? What do you see instead?
See above.

What version of the product are you using? On what operating system? Which
version of Java (Sun/Oracle? OpenJDK?) ?
Java 7 (1.7.0_04)
Thumbnailator 0.41
Amazon Linux AMI 2012.03

Please provide any additional information below.

Original issue reported on code.google.com by eyalaru...@gmail.com on 4 May 2012 at 10:17

GoogleCodeExporter commented 9 years ago
Thank you for the bug report.

The problem has been reproduced, and I'll try to get a fix out this weekend.

Original comment by coobird...@gmail.com on 4 May 2012 at 10:30

GoogleCodeExporter commented 9 years ago
Thank you.
For now I'm renaming the file manually and using "toFile()" with:
int lastDot = origPath.toString().lastIndexOf(".");
String thumbPath= origPath.substring(0,lastDot) + ".thumb" + 
localPath.substring(lastDot);

And just for the feedback:
This library is very useful and easy to use,
so thank you, it's great.

Original comment by eyalaru...@gmail.com on 4 May 2012 at 10:34

GoogleCodeExporter commented 9 years ago
Thank you for your kind words :)

The issue was that instead of looking for the last "." in the file name, the 
first dot was being used. (Basically, the code was using `indexOf` where it 
should have been using an `lastIndexOf`)

The bug has been fixed, so I'll be releasing Thumbnailator 0.4.2 very soon.

----------

Additional note for future reference:

Both the `Rename.SUFFIX_DOT_THUMBNAIL` and `Rename.SUFFIX_HYPHEN_THUMBNAIL` 
rename options were affected by this problem, as the issue lied in the 
`Rename.appendSuffix` method which was used by both of the above-mentioned 
options.

Original comment by coobird...@gmail.com on 6 May 2012 at 10:53

GoogleCodeExporter commented 9 years ago
Thumbnailator 0.4.2 has been release to address this issue.

Sorry for the inconvenience, and thank you for the bug report! :)

Original comment by coobird...@gmail.com on 6 May 2012 at 11:14