]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Avoid unnecessary home lookup when path begins with ~user
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Nov 2023 22:08:52 +0000 (00:08 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:10 +0000 (12:34 +0200)
Lookup home only when path begins with ~/, since it's the only one being
expanded to home.

src/lib-storage/mail-user.c

index 06d34fb5f8f5338fd7f6ff7287288c7b722272c4..8f59a714a440bece051ae71486db55affb8c2436 100644 (file)
@@ -557,7 +557,7 @@ int mail_user_try_home_expand(struct mail_user *user, const char **pathp)
 {
        const char *home, *path = *pathp;
 
-       if (*path != '~') {
+       if (!str_begins_with(path, "~/") && strcmp(path, "~") != 0) {
                /* no need to expand home */
                return 0;
        }