Author eryksun
Recipients barneygale, eryksun, serhiy.storchaka, steve.dower
Date 2021-04-07.23:29:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
For a "~user" path, the value of userhome should always be used if target_user == current_user. If for some reason the USERPROFILE environment variable isn't defined, the fallback "%HOMEDRIVE%%HOMEPATH%" does not necessarily end in the user's name. Example rewrite:

    if i != 1: #~user
        target_user = path[1:i]
        if isinstance(target_user, bytes):
            target_user = os.fsdecode(target_user)
        current_user = os.environ.get('USERNAME')

        if target_user != current_user:
            # Try to guess user home directory.  By default all user
            # profile directories are located in the same place and are
            # named by corresponding usernames.  If userhome isn't a
            # normal profile directory, this guess is likely wrong,
            # so we bail out.
            if current_user != basename(userhome):
                return path
            userhome = join(dirname(userhome), target_user)
Date User Action Args
2021-04-07 23:29:42eryksunsetrecipients: + eryksun, serhiy.storchaka, steve.dower, barneygale
2021-04-07 23:29:42eryksunsetmessageid: <>
2021-04-07 23:29:42eryksunlinkissue39899 messages
2021-04-07 23:29:41eryksuncreate