Skip to content

Commit 18bb9cf

Browse files
authored
Merge pull request #164 from KhronosGroup/fix-mime-types
Fix png detection and strip period from extension for mime types
2 parents 7e8a7da + 5558e24 commit 18bb9cf

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGES.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
Change Log
22
==========
33

4-
### Next Release
4+
### v2.1.1 - 2018-04-04
55

66
##### Additions :tada:
77
* Add support for exporting double sided materials [#133](https://github.com/KhronosGroup/COLLADA2GLTF/pull/133)
88

9+
##### Fixes :wrench:
10+
* Fixed issue where incorrect mime types were being generated [#162](https://github.com/KhronosGroup/COLLADA2GLTF/pull/164)
11+
912
### v2.1.0 - 2018-03-15
1013

1114
##### Additions :tada:

GLTF/src/GLTFImage.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ GLTF::Image::Image(std::string uri, std::string cacheKey) : uri(uri), cacheKey(c
1414
GLTF::Image::Image(std::string uri) : Image(uri, "") {}
1515

1616
GLTF::Image::Image(std::string uri, std::string cacheKey, unsigned char* data, size_t byteLength, std::string fileExtension) : uri(uri), data(data), byteLength(byteLength), cacheKey(cacheKey) {
17-
std::string dataSubstring((char*)data, 9);
18-
if (dataSubstring.substr(1, 8) == "PNG\r\n\x1a\n") {
17+
std::string dataSubstring((char*)data, 8);
18+
if (dataSubstring.substr(1, 7) == "PNG\r\n\x1a\n") {
1919
mimeType = "image/png";
2020
}
2121
else if (data[0] == 255 && data[1] == 216) {
@@ -41,6 +41,7 @@ GLTF::Image* GLTF::Image::load(path imagePath) {
4141
return imageCacheIt->second;
4242
}
4343
std::string fileExtension = imagePath.extension().string();
44+
fileExtension.erase(0, 1);
4445
GLTF::Image* image = NULL;
4546
FILE* file = fopen(fileString.c_str(), "rb");
4647
if (file == NULL) {

0 commit comments

Comments
 (0)