Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8626] iOS: Filesystem - TiBlob image Mimetype not correctly set when extension not lowercase

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsapi, tc-more-info
ReporterMunHon Chan
AssigneeUnknown
Created2012-01-12T23:59:22.000+0000
Updated2018-02-28T20:03:36.000+0000

Description

Problem

When reading a file using Ti.Filesystem.getFile(), followed by file.read(), the resultant TiBlob object will not be initialized as an image if the filename has a non-lowercase extension (e.g. image.JPG). Therefore, no image functions are usable (width, height, resize etc).

Test case

Insert your test case here

Logs

Insert any output or errors here

Proposed Solution

In Mimetypes.m, perform a lowercase conversion for the extension. However, I am not certain if there is a reason to keep case sensitivity for MIME type extensions.
+ (NSString *)mimeTypeForExtension:(NSString *)ext
{
	[Mimetypes initialize];
	NSString *result=[mimeTypeFromExtensionDict objectForKey:[[ext pathExtension] lowercaseString]];
	if (result == nil){
		result = @"application/octet-stream";
	}
	return result;
}

Comments

  1. Paul Dowsett 2012-01-15

    Thanks for raising this ticket. In order for me to escalate it to the core team, all the fields must be complete. Please check it against the [JIRA Ticket Checklist](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist), and add any missing information. For the description field, you can use [this template](https://wiki.appcelerator.org/display/guides/JIRA+Ticket+Template) as a starting point (simply copy and paste it). Furthermore, we must be able to reproduce the issue in order to accept it, and so a test case must be included and run without modification, as per the [Creating a Test Case](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-CreatingaTestCase) section. Thanks in advance for your cooperation. Cheers
  2. Paul Dowsett 2012-01-15

    Thank you for including the solution in this ticket. Please see [How to Contribute Code](https://wiki.appcelerator.org/display/guides/How+to+Contribute+Code) to allow us to accept it. If you have [signed the CLA](https://wiki.appcelerator.org/display/guides/How+to+Contribute+Code#HowtoContributeCode-SigningtheContributorsLicenseAgreement%28CLA%29), please add a comment containing your github user id. Thank you

JSON Source