Skip to content

Commit

Permalink
parse username and password for connection string to escape special c…
Browse files Browse the repository at this point in the history
…haracters (#11)

* parse username and password for connection string to escape special characters

* remove print for debugging
  • Loading branch information
sparul93 authored Sep 11, 2024
1 parent c32f0bf commit 1244068
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/filepass/filepass.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
from urllib.parse import quote

import fs
import fs.ftpfs
Expand Down Expand Up @@ -28,8 +29,8 @@ def sftp_connection(logger, conn_details: ConnectionDetails):
)
fs_conn = fs.open_fs(
"sftp://{}:{}@{}:{}{}".format(
conn_details.user,
conn_details.password,
quote(conn_details.user),
quote(conn_details.password),
conn_details.server,
conn_details.port,
conn_details.dir,
Expand Down Expand Up @@ -57,8 +58,8 @@ def smb_connection(logger, conn_details: ConnectionDetails):
)
fs_conn = fs.open_fs(
"smb://{}:{}@{}:{}/{}?direct-tcp=True&name-port=139&timeout=15&domain=".format(
conn_details.user,
conn_details.password,
quote(conn_details.user),
quote(conn_details.password),
conn_details.server,
conn_details.port,
conn_details.share + conn_details.dir,
Expand Down

0 comments on commit 1244068

Please sign in to comment.