Skip to content

Commit be154a1

Browse files
authored
chore(storage): bring MultipartFormData to repository (#553)
1 parent b7fb06e commit be154a1

File tree

6 files changed

+692
-80
lines changed

6 files changed

+692
-80
lines changed

Package.resolved

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ let package = Package(
2222
.library(name: "Supabase", targets: ["Supabase", "Functions", "PostgREST", "Auth", "Realtime", "Storage"]),
2323
],
2424
dependencies: [
25-
.package(url: "https://github.com/grdsdev/MultipartFormData", from: "0.1.0"),
2625
.package(url: "https://github.com/apple/swift-crypto.git", "1.0.0" ..< "4.0.0"),
2726
.package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.1.0"),
2827
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.3.2"),
@@ -131,7 +130,6 @@ let package = Package(
131130
.target(
132131
name: "Storage",
133132
dependencies: [
134-
"MultipartFormData",
135133
"Helpers",
136134
]
137135
),

Sources/Storage/Helpers.swift

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,70 +7,6 @@
77

88
import Foundation
99

10-
#if canImport(MobileCoreServices)
11-
import MobileCoreServices
12-
#elseif canImport(CoreServices)
13-
import CoreServices
14-
#endif
15-
16-
#if canImport(UniformTypeIdentifiers)
17-
import UniformTypeIdentifiers
18-
19-
func mimeType(forPathExtension pathExtension: String) -> String {
20-
#if swift(>=5.9)
21-
if #available(iOS 14, macOS 11, tvOS 14, watchOS 7, visionOS 1, *) {
22-
return UTType(filenameExtension: pathExtension)?.preferredMIMEType
23-
?? "application/octet-stream"
24-
} else {
25-
if let id = UTTypeCreatePreferredIdentifierForTag(
26-
kUTTagClassFilenameExtension, pathExtension as CFString, nil
27-
)?.takeRetainedValue(),
28-
let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?
29-
.takeRetainedValue()
30-
{
31-
return contentType as String
32-
}
33-
34-
return "application/octet-stream"
35-
}
36-
#else
37-
if #available(iOS 14, macOS 11, tvOS 14, watchOS 7, *) {
38-
return UTType(filenameExtension: pathExtension)?.preferredMIMEType
39-
?? "application/octet-stream"
40-
} else {
41-
if let id = UTTypeCreatePreferredIdentifierForTag(
42-
kUTTagClassFilenameExtension, pathExtension as CFString, nil
43-
)?.takeRetainedValue(),
44-
let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?
45-
.takeRetainedValue()
46-
{
47-
return contentType as String
48-
}
49-
50-
return "application/octet-stream"
51-
}
52-
#endif
53-
}
54-
#else
55-
56-
// MARK: - Private - Mime Type
57-
58-
func mimeType(forPathExtension pathExtension: String) -> String {
59-
#if canImport(CoreServices) || canImport(MobileCoreServices)
60-
if let id = UTTypeCreatePreferredIdentifierForTag(
61-
kUTTagClassFilenameExtension, pathExtension as CFString, nil
62-
)?.takeRetainedValue(),
63-
let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?
64-
.takeRetainedValue()
65-
{
66-
return contentType as String
67-
}
68-
#endif
69-
70-
return "application/octet-stream"
71-
}
72-
#endif
73-
7410
extension String {
7511
var pathExtension: String {
7612
(self as NSString).pathExtension

0 commit comments

Comments
 (0)