Skip to content

Commit e33020c

Browse files
committed
fix(sltt-app): try creating full lan folder path even if connectToSamba fails
1 parent 6d8f42e commit e33020c

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

storage/connections.ts

+17-5
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,23 @@ export const handleProbeConnections = async (defaultStoragePath: string, { urls
114114
const isConnected = await connectToSamba(ipAddress)
115115
if (isConnected) {
116116
lastSambaIP = ipAddress
117-
// create the full path, if it doesn't exist
118-
if (urlObj.pathname === `/${SHARE_NAME}/${SLTT_APP_LAN_FOLDER}`) {
119-
console.log(`Creating full folder path '(${ipAddress}:)${urlObj.pathname}' if needed...`)
120-
await ensureDir(fileURLToPath(url))
121-
}
117+
} else {
118+
// NOTE: one of the reasons `isConnected` can be `false` is due to the following Windows error
119+
// which can occur when there are too many existing connections to the same folder
120+
// e.g. if \\192.168.8.1\sltt-local-team-storage is open in the File Explorer.
121+
//
122+
// The error:
123+
// System error 1219 has occurred.
124+
// Multiple connections to a server or shared resource by the same user,
125+
// using more than one user name, are not allowed. Disconnect all previous
126+
// connections to the server or shared resource and try again.
127+
console.log(`Try closing other windows that may be connected to the smb folder ${ipAddress}\\\\${SHARE_NAME} and try again.`)
128+
}
129+
// create the full path, if it doesn't exist
130+
// NOTE: even if the connectToSamba fails, it's possible that the user still has folder access
131+
if (urlObj.pathname === `/${SHARE_NAME}/${SLTT_APP_LAN_FOLDER}`) {
132+
console.log(`Creating full folder path '(${ipAddress}:)${urlObj.pathname}' if needed...`)
133+
await ensureDir(fileURLToPath(url))
122134
}
123135
}
124136
filePath = fileURLToPath(url)

0 commit comments

Comments
 (0)