Removed debug logs from the DocCMiddleware middleware in the library target.
This commit is contained in:
parent
f9e8088088
commit
8b3e9e47fd
@ -2,7 +2,10 @@ import Hummingbird
|
||||
import Logging
|
||||
import NIOPosix
|
||||
|
||||
struct DocCMiddleware<Context: RequestContext, AssetProvider: FileProvider>: RouterMiddleware {
|
||||
struct DocCMiddleware<
|
||||
Context: RequestContext,
|
||||
AssetProvider: FileProvider
|
||||
>: RouterMiddleware {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
@ -22,7 +25,6 @@ struct DocCMiddleware<Context: RequestContext, AssetProvider: FileProvider>: Rou
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
init(assetProvider: AssetProvider) {
|
||||
self.assetProvider = assetProvider
|
||||
}
|
||||
@ -50,9 +52,7 @@ struct DocCMiddleware<Context: RequestContext, AssetProvider: FileProvider>: Rou
|
||||
Redirect requests to / and /documentation to /documentation/
|
||||
Redirect requests to /tutorials to /tutorials/
|
||||
*/
|
||||
|
||||
print(uriPath)
|
||||
|
||||
|
||||
guard uriPath.starts(with: /^\/archives\/\w+/) else {
|
||||
return try await next(input, context)
|
||||
}
|
||||
@ -60,10 +60,7 @@ struct DocCMiddleware<Context: RequestContext, AssetProvider: FileProvider>: Rou
|
||||
let pathArchive = Path.archivePath(from: uriPath)
|
||||
let nameArchive = Path.archiveName(from: uriPath)
|
||||
let uriResource = Path.resourcePath(from: uriPath)
|
||||
|
||||
print(nameArchive)
|
||||
print(uriResource)
|
||||
|
||||
|
||||
if uriResource == .forwardSlash {
|
||||
return .redirect(to: uriPath + "/documentation")
|
||||
}
|
||||
@ -125,16 +122,10 @@ private extension DocCMiddleware {
|
||||
|
||||
func serveFile(
|
||||
_ path: String,
|
||||
at folder: String? = nil,
|
||||
at folder: String,
|
||||
context: Context
|
||||
) async throws -> Response {
|
||||
let filePath = if let folder {
|
||||
folder + path
|
||||
} else {
|
||||
path
|
||||
}
|
||||
|
||||
print(filePath)
|
||||
let filePath = folder + path
|
||||
|
||||
guard let fileIdentifier = assetProvider.getFileIdentifier(filePath) else {
|
||||
throw HTTPError(.notFound)
|
||||
@ -142,9 +133,6 @@ private extension DocCMiddleware {
|
||||
|
||||
let body = try await assetProvider.loadFile(id: fileIdentifier, context: context)
|
||||
|
||||
print(fileIdentifier)
|
||||
print(body)
|
||||
|
||||
return .init(status: .ok, headers: [:], body: body)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user