Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix date check in messages. #1264

Merged
merged 2 commits into from
Oct 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions sarracenia/flow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1489,24 +1489,23 @@ def file_should_be_downloaded(self, msg) -> bool:
new_mtime = sarracenia.timestr2flt(msg['mtime'])
old_mtime = 0.0

if self.o.timeCopy:
old_mtime = lstat.st_mtime
elif sarracenia.filemetadata.supports_extended_attributes:
try:
x = sarracenia.filemetadata.FileMetadata(msg['new_path'])
old_mtime = sarracenia.timestr2flt(x.get('mtime'))
except:
pass
if self.o.timeCopy:
old_mtime = lstat.st_mtime
elif sarracenia.filemetadata.supports_extended_attributes:
try:
x = sarracenia.filemetadata.FileMetadata(msg['new_path'])
old_mtime = sarracenia.timestr2flt(x.get('mtime'))
except:
pass

if new_mtime <= old_mtime:
self.reject(msg, 406,
if new_mtime <= old_mtime:
self.reject(msg, 406,
"mtime not newer %s " % (msg['new_path']))
return False
else:
logger.debug(
"{} new version is {} newer (new: {} vs old: {} )".format(
msg['new_path'], new_mtime - old_mtime, new_mtime,
old_mtime))
return False
else:
logger.debug(
f"{msg['new_path']} new version is {new_mtime - old_mtime} " \
f"newer (new: {new_mtime,} vs old: {old_mtime} )" )

elif method in ['random', 'cod']:
logger.debug("content_match %s sum random/zero/cod never matches" %
Expand Down
Loading