Skip to content

Commit

Permalink
mime should work on linux now
Browse files Browse the repository at this point in the history
  • Loading branch information
Ondrej Rafaj authored and Ondrej Rafaj committed Dec 15, 2016
1 parent c0ac3f8 commit a0fb5df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ let package = Package(
name: "S3",
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1),
.Package(url: "https://github.com/JustinM1/S3SignerAWS.git", majorVersion: 1, minor: 1)
.Package(url: "https://github.com/JustinM1/S3SignerAWS.git", majorVersion: 1, minor: 1),
.Package(url: "https://github.com/manGoweb/MimeLib.git", majorVersion: 1)
],
exclude: [

Expand Down
10 changes: 3 additions & 7 deletions Sources/S3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,10 @@ public class S3 {
internal extension S3 {

internal func mimeType(forFileAtUrl url: URL) -> String {
let pathExtension: String = url.pathExtension

if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue() {
if let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
return mimetype as String
}
guard let mime: String = Mime.string(fileUrl: url) else {
return "application/octet-stream"
}
return "application/octet-stream"
return mime.rawValue
}

internal func vaporHeaders(_ headers: [String: String]) -> [HeaderKey : String] {
Expand Down

0 comments on commit a0fb5df

Please sign in to comment.