Skip to content

Commit

Permalink
Issue #29
Browse files Browse the repository at this point in the history
I fix issue #29 (Invalid MIME type at purchase invoice documents) by
using the MIME type from Magic.getMagicMatch() instead of the MIME type
submitted by the browser.

Furthermore, I write the Spock specification for it.
  • Loading branch information
dellermann committed Jan 9, 2014
1 parent d07734b commit b1cb41c
Show file tree
Hide file tree
Showing 4 changed files with 402 additions and 62 deletions.
6 changes: 3 additions & 3 deletions application.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Grails Metadata file
#Thu Jan 09 12:00:30 CET 2014
app.buildDate=2014-01-09T12\:00\:30+0100
app.buildNumber=5601
#Thu Jan 09 14:57:48 CET 2014
app.buildDate=2014-01-09T14\:57\:48+0100
app.buildNumber=5631
app.buildProfile=test
app.grails.version=2.3.4.BUILD-SNAPSHOT
app.name=GrailsUnitTestMixin
Expand Down
6 changes: 3 additions & 3 deletions grails-app/domain/org/amcworld/springcrm/DataFile.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DataFile {
static constraints = {
fileName blank: false
mimeType nullable: true
fileSize range: 0L..104857600L // 0..100M
fileSize range: 0L..104_857_600L // 0..100M
dateCreated()
lastUpdated()
}
Expand Down Expand Up @@ -136,13 +136,13 @@ class DataFile {
}

this.fileName = file.originalFilename
this.mimeType = file.contentType ?: Magic.getMagicMatch(file.bytes).mimeType
this.mimeType = Magic.getMagicMatch(file.bytes).mimeType
this.fileSize = file.size
}

@Override
String toString() {
fileName
fileName ?: ''
}
}

Expand Down

0 comments on commit b1cb41c

Please sign in to comment.