Skip to content

Commit

Permalink
Adding a file no longer uses full path as title
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-astro authored Aug 1, 2024
1 parent df8f57c commit e9e4260
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions vlt.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Version used for auto-updater
__version__="1.9.4"
__version__="1.9.6"

import sys
import os
Expand Down Expand Up @@ -1202,7 +1202,10 @@ def ListVaultDirectory():
if doesExist == False:
try:
with open(inputArgs[1], "rb") as file:
vaultData['files'].append({"title":inputArgs[1],"type":"file","content":"","encryption":"normal"})
filename = inputArgs[1]
if '/' in filename:
filename = filename.split('/')[-1]
vaultData['files'].append({"title":filename,"type":"file","content":"","encryption":"normal"})

vaultData['files'][-1]['content'] = str(base64.urlsafe_b64encode(file.read()), "utf-8")

Expand All @@ -1213,7 +1216,7 @@ def ListVaultDirectory():

refreshCommands()

print("Added new file \"" + inputArgs[1] + "\"")
print("Added new file called: \""+filename+"\", located at path: \"" + inputArgs[1] + "\"")
print()
except:
print(Fore.RED + "File at \"" + inputArgs[1] + "\" was not found" + Style.RESET_ALL)
Expand Down Expand Up @@ -1329,7 +1332,7 @@ def ListVaultDirectory():


# Command to remove an entry `remove <name>`
elif inputArgs[0].upper() == "REMOVE":
elif inputArgs[0].upper() == "REMOVE" or inputArgs[0].upper() == "RM":
if len(inputArgs) >= 2:
for f in vaultData['files']:
if inputArgs[1] == f['title'].strip():
Expand Down Expand Up @@ -1698,7 +1701,7 @@ def ListVaultDirectory():
append <name> "<content (in quotes)>"
Command to append a line to an existing entry
remove <name>
remove/rm <name>
PERMANENTLY delete an entry. This process is irreversible
addfile <path>
Expand Down

0 comments on commit e9e4260

Please sign in to comment.