Skip to content

Commit

Permalink
Update cryptomator.py
Browse files Browse the repository at this point in the history
- fixed symbolic linking to directories (need a copy of target dir.c9r)
  • Loading branch information
maxpat78 committed Sep 25, 2024
1 parent 8a20a97 commit e966726
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cryptomator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import argparse, getpass, hashlib, struct, base64
import json, sys, io, os, operator
import time, zipfile, locale, zlib, uuid
import time, zipfile, locale, zlib, uuid, shutil
from os.path import *

try:
Expand Down Expand Up @@ -437,7 +437,8 @@ def remove(p, virtualpath):
print('rm: %s: is a directory' % virtualpath)
return
if x.hasSym:
# remove symlink.c9r and its parent
# remove symlink.c9r (and dir.c9r if link to a directory) and its parent
if x.isDir: os.remove(x.dirC9)
os.remove(x.hasSym)
os.rmdir(x.realPathName)
if x.longName:
Expand Down Expand Up @@ -516,6 +517,9 @@ def ln(p, target, symlink):
out = open(join(a.realPathName, 'symlink.c9r'), 'wb')
Vault._encryptf(p.pk, io.BytesIO(target.encode()), out) # does not check target existance
out.close()
b = p.getInfo(target)
if b.isDir:
shutil.copy(b.dirC9, a.realPathName) # copy the original dir.c9r also

def ls(p, virtualpath, recursive=False):
"Print a list of contents of a virtual path"
Expand Down

0 comments on commit e966726

Please sign in to comment.