fix(parse): fix tests and many issues (#9)
This commit is contained in:
parent
c639cfcfd9
commit
509e99913a
@ -10,7 +10,7 @@ export const parse = url => {
|
||||
url = url.url
|
||||
}
|
||||
|
||||
const remote = {}
|
||||
const remote = {url}
|
||||
|
||||
const [type, rest] = url.split('://')
|
||||
if (type === 'file') {
|
||||
@ -24,12 +24,12 @@ export const parse = url => {
|
||||
remote.share = share
|
||||
} else if (type === 'smb') {
|
||||
remote.type = 'smb'
|
||||
const lastArobas = rest.lastIndexOf('@')
|
||||
const smb = rest.slice(lastArobas)
|
||||
const auth = rest.slice(0, lastArobas)
|
||||
const lastAtSign = rest.lastIndexOf('@')
|
||||
const smb = rest.slice(lastAtSign + 1)
|
||||
const auth = rest.slice(0, lastAtSign)
|
||||
const firstColon = auth.indexOf(':')
|
||||
const username = auth.slice(0, firstColon)
|
||||
const password = auth.slice(firstColon)
|
||||
const password = auth.slice(firstColon + 1)
|
||||
const [domain, sh] = smb.split('\\\\')
|
||||
const [host, path] = sh.split('\0')
|
||||
remote.host = host
|
||||
|
@ -19,7 +19,7 @@ const data = {
|
||||
url: 'smb://Administrator:password@toto\\\\192.168.100.225\\smb\0',
|
||||
type: 'smb',
|
||||
host: '192.168.100.225\\smb',
|
||||
path: undefined,
|
||||
path: '',
|
||||
domain: 'toto',
|
||||
username: 'Administrator',
|
||||
password: 'password'
|
||||
@ -28,7 +28,7 @@ const data = {
|
||||
url: 'smb://Administrator:pass@word@toto\\\\192.168.100.225\\smb\0',
|
||||
type: 'smb',
|
||||
host: '192.168.100.225\\smb',
|
||||
path: undefined,
|
||||
path: '',
|
||||
domain: 'toto',
|
||||
username: 'Administrator',
|
||||
password: 'pass@word'
|
||||
@ -37,7 +37,7 @@ const data = {
|
||||
url: 'smb://Administrator:pass:word@toto\\\\192.168.100.225\\smb\0',
|
||||
type: 'smb',
|
||||
host: '192.168.100.225\\smb',
|
||||
path: undefined,
|
||||
path: '',
|
||||
domain: 'toto',
|
||||
username: 'Administrator',
|
||||
password: 'pass:word'
|
||||
|
Loading…
Reference in New Issue
Block a user