Skip to content

Commit

Permalink
Fixed an issue where file names were not being decoded correctly in q…
Browse files Browse the repository at this point in the history
…uery directory requests.
  • Loading branch information
kishikawakatsumi committed Sep 18, 2024
1 parent 81198af commit 6c74d7d
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 6c74d7d

Please sign in to comment.