diff --git a/src/core/wopi.py b/src/core/wopi.py index f826902a..2c3cebb3 100644 --- a/src/core/wopi.py +++ b/src/core/wopi.py @@ -261,8 +261,8 @@ def setLock(fileid, reqheaders, acctok): retrievedLock, lockHolder = utils.retrieveWopiLock(fileid, op, lock, acctok) # validate against either the given lock (RefreshLock case) or the given old lock (UnlockAndRelock case) if retrievedLock and not utils.compareWopiLocks(retrievedLock, (oldLock if oldLock else lock)): - # lock mismatch, the WOPI client is supposed to acknowledge the existing lock - # and deny access to the file in edit mode otherwise + # lock mismatch, the WOPI client is supposed to acknowledge the existing lock to start a collab session, + # or deny access to the file in edit mode otherwise return utils.makeConflictResponse(op, acctok['userid'], retrievedLock, lock, oldLock, acctok['endpoint'], fn, 'The file is locked by %s' % (lockHolder if lockHolder != 'wopi' else 'another online editor')) # TODO cleanup 'wopi' case diff --git a/src/core/wopiutils.py b/src/core/wopiutils.py index cd19fc32..9b9f774f 100644 --- a/src/core/wopiutils.py +++ b/src/core/wopiutils.py @@ -143,7 +143,7 @@ def validateAndLogHeaders(op): # update bookkeeping of pending sessions if op.title() == 'Checkfileinfo' and session in srv.conflictsessions['pending'] and \ - time.mktime(time.strptime(srv.conflictsessions['pending'][session]['time'])) < time.time() - 300: + time.mktime(time.strptime(srv.conflictsessions['pending'][session]['time'])) < time.time() - 300: # a previously conflicted session is still around executing Checkfileinfo after 5 minutes, assume it got resolved _resolveSession(session, acctok['filename']) return acctok, None diff --git a/src/core/xrootiface.py b/src/core/xrootiface.py index 3e790e18..3e50f822 100644 --- a/src/core/xrootiface.py +++ b/src/core/xrootiface.py @@ -200,10 +200,11 @@ def statx(endpoint, fileref, userid, versioninv=1): + '&mgm.pcmd=fileinfo&mgm.file.info.option=-m') try: # output looks like: - # keylength.file=35 file=/eos/.../filename size=2915 mtime=1599649863.0 ctime=1599649866.280468540 btime=1599649866.280468540 clock=0 mode=0644 - # uid=4179 gid=2763 fxid=19ab8b68 fid=430672744 ino=115607834422411264 pid=1713958 pxid=001a2726 xstype=adler xs=a2dfcdf9 - # etag="115607834422411264:a2dfcdf9" detached=0 layout=replica nstripes=2 lid=00100112 nrep=2 xattrn=sys.eos.btime xattrv=1599649866.280468540 - # uid:xxxx[username] gid:xxxx[group] tident:xxx name:username dn: prot:https host:xxxx.cern.ch domain:cern.ch geo: sudo:0 fsid=305 fsid=486 + # keylength.file=35 file=/eos/.../filename size=2915 mtime=1599649863.0 ctime=1599649866.280468540 + # btime=1599649866.280468540 clock=0 mode=0644 uid=xxxx gid=xxxx fxid=19ab8b68 fid=430672744 ino=115607834422411264 + # pid=1713958 pxid=001a2726 xstype=adler xs=a2dfcdf9 etag="115607834422411264:a2dfcdf9" detached=0 layout=replica + # nstripes=2 lid=00100112 nrep=2 xattrn=sys.eos.btime xattrv=1599649866.280468540 uid:xxxx[username] gid:xxxx[group] + # tident:xxx name:username dn: prot:https host:xxxx.cern.ch domain:cern.ch geo: sudo:0 fsid=305 fsid=486 # cf. https://gitlab.cern.ch/dss/eos/-/blob/master/archive/eosarch/utils.py kvlist = [kv.split('=') for kv in statInfo.split()] statxdata = {k: v.strip('"') for k, v in [kv for kv in kvlist if len(kv) == 2]} diff --git a/src/wopiserver.py b/src/wopiserver.py index 6367025e..6a32844e 100755 --- a/src/wopiserver.py +++ b/src/wopiserver.py @@ -77,7 +77,6 @@ class Wopi: # sets of sessions for which a lock conflict is outstanding or resolved conflictsessions = {'pending': {}, 'resolved': {}} - @classmethod def init(cls): '''Initialises the application, bails out in case of failures. Note this is not a __init__ method''' @@ -344,8 +343,8 @@ def iopOpenInApp(): if bridge.issupported(appname): try: res['app-url'], res['form-parameters'] = bridge.appopen(utils.generateWopiSrc(inode), acctok, - (appname, appurl, url_unquote_plus(req.args.get('appinturl', appurl)), req.headers.get('ApiKey')), - viewmode, usertoken) + (appname, appurl, url_unquote_plus(req.args.get('appinturl', appurl)), req.headers.get('ApiKey')), # noqa: E128 + viewmode, usertoken) except bridge.FailedOpen as foe: return foe.msg, foe.statuscode else: