check for missing entity before other checks

This commit is contained in:
Alan Hamlett 2018-12-28 18:19:32 -06:00
parent 58a8ddcc8b
commit e7ee7a3369
2 changed files with 5 additions and 4 deletions

View file

@ -249,15 +249,15 @@ class Heartbeat(object):
if self.type != 'file':
return
if not self.entity:
return
if not is_win:
return
if self._file_exists():
return
if not self.entity:
return
self.args.local_file = self._to_unc_path(self.entity)
def _to_unc_path(self, filepath):

View file

@ -81,7 +81,8 @@ def format_file_path(filepath):
is_windows_network_mount = WINDOWS_NETWORK_MOUNT_PATTERN.match(filepath)
filepath = os.path.realpath(os.path.abspath(filepath))
filepath = re.sub(BACKSLASH_REPLACE_PATTERN, '/', filepath)
if WINDOWS_DRIVE_PATTERN.match(filepath):
is_windows_drive = WINDOWS_DRIVE_PATTERN.match(filepath)
if is_windows_drive:
filepath = filepath.capitalize()
if is_windows_network_mount:
# Add back a / to the front, since the previous modifications