Skip to content

Commit

Permalink
Merge pull request #138 from kishikawakatsumi/fix
Browse files Browse the repository at this point in the history
Fixed an issue where file names were not being decoded correctly in query directory requests.
  • Loading branch information
kishikawakatsumi authored Sep 18, 2024
2 parents 81198af + 6c74d7d commit 5a3ce1e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Sources/SMBClient/Session.swift
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,15 @@ public class Session {

let outputBufferLength = min(1048576, maxTransactSize)
let creditSize = creditSize(size: outputBufferLength)
let fileInformationClass = QueryDirectory.FileInformationClass.fileDirectoryInformation

let queryDirectoryRequest = QueryDirectory.Request(
creditCharge: creditSize,
headerFlags: [.relatedOperations],
messageId: messageId.next(count: UInt64(creditSize)),
treeId: treeId,
sessionId: sessionId,
fileInformationClass: .fileDirectoryInformation,
fileInformationClass: fileInformationClass,
fileId: temporaryUUID,
fileName: pattern,
outputBufferLength: outputBufferLength
Expand All @@ -318,7 +320,6 @@ public class Session {
)

let createResponse = Create.Response(data: data)

var files = [FileDirectoryInformation]()

let queryDirectoryResponse = QueryDirectory.Response(data: Data(data[createResponse.header.nextCommand...]))
Expand All @@ -333,7 +334,7 @@ public class Session {
messageId: messageId.next(count: UInt64(creditSize)),
treeId: treeId,
sessionId: sessionId,
fileInformationClass: .fileIdBothDirectoryInformation,
fileInformationClass: fileInformationClass,
flags: [],
fileId: fileId,
fileName: pattern,
Expand Down

0 comments on commit 5a3ce1e

Please sign in to comment.