Skip to content

Commit

Permalink
Fixed Media model case sensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
mrzapp committed Aug 29, 2017
1 parent a0dde15 commit cb74e6b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hashbrown-cms",
"repository": "https://github.com/Putaitu/hashbrown-cms.git",
"version": "0.9.5",
"version": "0.9.6",
"description": "The pluggable CMS",
"main": "hashbrown.js",
"scripts": {
Expand Down
28 changes: 14 additions & 14 deletions public/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -9928,36 +9928,36 @@ var Media = function (_Resource) {


Media.prototype.getContentTypeHeader = function getContentTypeHeader() {
this.name = this.name || '';
var name = (this.name || '').toLowerCase();

// Image types
if (this.name.match(/\.jpg/)) {
if (name.match(/\.jpg/)) {
return 'image/jpeg';
} else if (this.name.match(/\.png/)) {
} else if (name.match(/\.png/)) {
return 'image/png';
} else if (this.name.match(/\.gif/)) {
} else if (name.match(/\.gif/)) {
return 'image/gif';
} else if (this.name.match(/\.bmp/)) {
} else if (name.match(/\.bmp/)) {
return 'image/bmp';

// Video types
} else if (this.name.match(/\.mp4/)) {
} else if (name.match(/\.mp4/)) {
return 'video/mp4';
} else if (this.name.match(/\.avi/)) {
} else if (name.match(/\.avi/)) {
return 'video/avi';
} else if (this.name.match(/\.mov/)) {
} else if (name.match(/\.mov/)) {
return 'video/quicktime';
} else if (this.name.match(/\.bmp/)) {
} else if (name.match(/\.bmp/)) {
return 'video/bmp';
} else if (this.name.match(/\.wmv/)) {
} else if (name.match(/\.wmv/)) {
return 'video/x-ms-wmv';
} else if (this.name.match(/\.3gp/)) {
} else if (name.match(/\.3gp/)) {
return 'video/3gpp';
} else if (this.name.match(/\.mkv/)) {
} else if (name.match(/\.mkv/)) {
return 'video/x-matroska';

// SVG
} else if (this.name.match(/\.svg/)) {
} else if (name.match(/\.svg/)) {
return 'image/svg+xml';

// Everything else
Expand Down Expand Up @@ -40009,7 +40009,7 @@ module.exports = ["address", "article", "aside", "blockquote", "canvas", "dd", "
module.exports = {
"name": "hashbrown-cms",
"repository": "https://github.com/Putaitu/hashbrown-cms.git",
"version": "0.9.5",
"version": "0.9.6",
"description": "The pluggable CMS",
"main": "hashbrown.js",
"scripts": {
Expand Down
28 changes: 14 additions & 14 deletions public/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -9145,36 +9145,36 @@ var Media = function (_Resource) {


Media.prototype.getContentTypeHeader = function getContentTypeHeader() {
this.name = this.name || '';
var name = (this.name || '').toLowerCase();

// Image types
if (this.name.match(/\.jpg/)) {
if (name.match(/\.jpg/)) {
return 'image/jpeg';
} else if (this.name.match(/\.png/)) {
} else if (name.match(/\.png/)) {
return 'image/png';
} else if (this.name.match(/\.gif/)) {
} else if (name.match(/\.gif/)) {
return 'image/gif';
} else if (this.name.match(/\.bmp/)) {
} else if (name.match(/\.bmp/)) {
return 'image/bmp';

// Video types
} else if (this.name.match(/\.mp4/)) {
} else if (name.match(/\.mp4/)) {
return 'video/mp4';
} else if (this.name.match(/\.avi/)) {
} else if (name.match(/\.avi/)) {
return 'video/avi';
} else if (this.name.match(/\.mov/)) {
} else if (name.match(/\.mov/)) {
return 'video/quicktime';
} else if (this.name.match(/\.bmp/)) {
} else if (name.match(/\.bmp/)) {
return 'video/bmp';
} else if (this.name.match(/\.wmv/)) {
} else if (name.match(/\.wmv/)) {
return 'video/x-ms-wmv';
} else if (this.name.match(/\.3gp/)) {
} else if (name.match(/\.3gp/)) {
return 'video/3gpp';
} else if (this.name.match(/\.mkv/)) {
} else if (name.match(/\.mkv/)) {
return 'video/x-matroska';

// SVG
} else if (this.name.match(/\.svg/)) {
} else if (name.match(/\.svg/)) {
return 'image/svg+xml';

// Everything else
Expand Down Expand Up @@ -35086,7 +35086,7 @@ module.exports = ["address", "article", "aside", "blockquote", "canvas", "dd", "
module.exports = {
"name": "hashbrown-cms",
"repository": "https://github.com/Putaitu/hashbrown-cms.git",
"version": "0.9.5",
"version": "0.9.6",
"description": "The pluggable CMS",
"main": "hashbrown.js",
"scripts": {
Expand Down
26 changes: 13 additions & 13 deletions src/Common/Models/Media.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,36 +66,36 @@ class Media extends Resource {
* @returns {String} Content-Type header
*/
getContentTypeHeader() {
this.name = this.name || '';
let name = (this.name || '').toLowerCase();

// Image types
if(this.name.match(/\.jpg/)) {
if(name.match(/\.jpg/)) {
return 'image/jpeg';
} else if(this.name.match(/\.png/)) {
} else if(name.match(/\.png/)) {
return 'image/png';
} else if(this.name.match(/\.gif/)) {
} else if(name.match(/\.gif/)) {
return 'image/gif';
} else if(this.name.match(/\.bmp/)) {
} else if(name.match(/\.bmp/)) {
return 'image/bmp';

// Video types
} else if(this.name.match(/\.mp4/)) {
} else if(name.match(/\.mp4/)) {
return 'video/mp4';
} else if(this.name.match(/\.avi/)) {
} else if(name.match(/\.avi/)) {
return 'video/avi';
} else if(this.name.match(/\.mov/)) {
} else if(name.match(/\.mov/)) {
return 'video/quicktime';
} else if(this.name.match(/\.bmp/)) {
} else if(name.match(/\.bmp/)) {
return 'video/bmp';
} else if(this.name.match(/\.wmv/)) {
} else if(name.match(/\.wmv/)) {
return 'video/x-ms-wmv';
} else if(this.name.match(/\.3gp/)) {
} else if(name.match(/\.3gp/)) {
return 'video/3gpp';
} else if(this.name.match(/\.mkv/)) {
} else if(name.match(/\.mkv/)) {
return 'video/x-matroska';

// SVG
} else if(this.name.match(/\.svg/)) {
} else if(name.match(/\.svg/)) {
return 'image/svg+xml';

// Everything else
Expand Down

0 comments on commit cb74e6b

Please sign in to comment.