Comments (2)
The "let cbdata = ..." line is the one that is at the heart of the problem (context.swift - line 343). When downloadItem() is called, this func is called twice before erroring out. The first time it appears to execute correctly (i.e., status = 0), but the second time through it fails (i.e., status = -22).
`
static let generic_handler: smb2_command_cb = { smb2, status, command_data, cbdata in
do {
guard try smb2.unwrap().pointee.fd >= 0 else { return }
let cbdata = try cbdata.unwrap().bindMemory(to: CBData.self, capacity: 1).pointee
if status != SMB2_STATUS_SUCCESS {
cbdata.result = status
}
cbdata.dataHandler?(command_data)
cbdata.isFinished = true
} catch { }
}
`
from amsmb2.
So it turns out that when a path
is provided to downloadItem()
or contents()
that "DOES NOT EXIST", LIBSMB2 responds with an ambiguous "Error Code 22 STATUS_INVALID_PARAMETER" error response, rather than a clear "Path does not exist" error response.
The root of the issue experienced was due to not trimming the leading slash from the path that was returned from the URLResourceKey.pathKey
value from contentsOfDirectory()
. Trimming that leading slash has AMSMB2 humming perfectly now.
Sorry for the multiple comments, but it simply wasn't an obvious error response and cost the better part of 8 hours trying to debug. Only after connecting against a Linux SMB share to gut check things and receiving the same error did it occur that this might be the case.
from amsmb2.
Related Issues (20)
- Library not loaded on iPhone device HOT 5
- Objective-c HOT 1
- Dependency "AMSMB2" has no shared framework schemes for any of the platforms: iOS
- Using to stream AV files.... HOT 1
- can someone know how to fix this HOT 1
- Upload the file keeping the original creation date HOT 1
- Cannot obtain data from Windows shares HOT 1
- Cannot extract data, move, download, copy; etc. from Linux or Windows shares with latin characters in file name HOT 8
- Which thread does amsmb2 run on HOT 1
- Connect to a Distributed File System-Namespaces HOT 1
- Uploading a folder HOT 1
- import AMSMB2 to xCode HOT 1
- macOS arm64 architecture missing HOT 2
- No such module 'SMB2' HOT 1
- Long delay when processing delete requests of recently uploaded items. HOT 1
- Struct smb2_context has removed member is_connected for the latest libsmb2? HOT 1
- Need support for M1 iphone simulator "arm64-apple-ios-simulator" HOT 1
- Build error: unsafe build flags HOT 7
- Intel x86_64 support does not work ? HOT 3
- init SMB2Manager throws error HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amsmb2.