Planned maintenance is scheduled for the week of June 15th - the exact date and time will be announced soon.
See More Details
Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
File Extension appears twice
Hi to everyone,
I am using Liferay EE 6.2, and had an issue with uploaded Files into Liferay portal. When i did upload files with a capitalized Extension (which can be any ... pdf,doc,csv..) like "Test.XXX" after downloading this file there was additional extension which looked like "Test.XXX.xxx" afterwards. If i'm not wrong that is a piece of code which is responsible In Liferay-Sourcecode, a method sendFile() in the WebServerServlet.java class.
So my conclusion is, as file extension is ".xxx", but uploading File has a capitalized extension ".XXX", additional ".xxx" extension will be added to the file, and you'll get "Test.XXX.xxx". If you upload a file with an extension "test.xxx" is everything ok, without the second extension to the File. We did implemented some workaround for us, just wanted to ask it here if someone else also have had this issue? Is it a Bug in Liferay or normal Liferay behavior, or i might understand smth wrong?
must note, I'm pretty new to liferay, so maybe I did wrong conclusion.
Would be thankful for any Explanation.
Thank you
I am using Liferay EE 6.2, and had an issue with uploaded Files into Liferay portal. When i did upload files with a capitalized Extension (which can be any ... pdf,doc,csv..) like "Test.XXX" after downloading this file there was additional extension which looked like "Test.XXX.xxx" afterwards. If i'm not wrong that is a piece of code which is responsible In Liferay-Sourcecode, a method sendFile() in the WebServerServlet.java class.
String fileName = fileVersion.getTitle();
String extension = fileVersion.getExtension();
if (Validator.isNotNull(extension) &&
!fileName.endsWith(StringPool.PERIOD + extension)) {
fileName += StringPool.PERIOD + extension;
}So my conclusion is, as file extension is ".xxx", but uploading File has a capitalized extension ".XXX", additional ".xxx" extension will be added to the file, and you'll get "Test.XXX.xxx". If you upload a file with an extension "test.xxx" is everything ok, without the second extension to the File. We did implemented some workaround for us, just wanted to ask it here if someone else also have had this issue? Is it a Bug in Liferay or normal Liferay behavior, or i might understand smth wrong?
must note, I'm pretty new to liferay, so maybe I did wrong conclusion.
Would be thankful for any Explanation.
Thank you
Well, the bug of course is that except for old DOS systems, you should not be using capitalized extensions on filenames.
Only windows is case-insensitive for extension, every other OS and even the web itself is case sensitive. For example, an image tag as <img src="/o/my-portlet/img/team.png" /> is going to fail miserably if the file is team.Png or team.PNG or Team.png or ...
So the convention is to use file extension as all lower case because that is the most common format used, and windows is quite happy to use lower case because it just doesn't care either.
Only windows is case-insensitive for extension, every other OS and even the web itself is case sensitive. For example, an image tag as <img src="/o/my-portlet/img/team.png" /> is going to fail miserably if the file is team.Png or team.PNG or Team.png or ...
So the convention is to use file extension as all lower case because that is the most common format used, and windows is quite happy to use lower case because it just doesn't care either.
Community
Company
Feedback