mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
fix notmuch-new bug when database path ends with a trailing /
I configured my database.path with a trailing /, and after running notmuch new every notmuch search would fail with error messages like this: Error opening /inbox/cur/1258565257.000211.mbox:2,S: No such file or directory The actual bug was in the filename normalization for storage in the database. The database.path was removed from the full filename, but if the database.path from the config file contained a trailing /, the relative file name would retain an extra leading /... which made it look like an absolute path after it was read out from the DB. Signed-off-by: Bart Trojanowski <bart@jukie.net>
This commit is contained in:
parent
369b44103d
commit
ceee152fca
1 changed files with 7 additions and 3 deletions
|
@ -411,10 +411,14 @@ _notmuch_message_set_filename (notmuch_message_t *message,
|
|||
db_path = notmuch_database_get_path (message->notmuch);
|
||||
db_path_len = strlen (db_path);
|
||||
|
||||
if (*s == '/' && strncmp (s, db_path, db_path_len) == 0
|
||||
&& strlen (s) > db_path_len)
|
||||
if (*s == '/' && strlen (s) > db_path_len
|
||||
&& strncmp (s, db_path, db_path_len) == 0)
|
||||
{
|
||||
s += db_path_len + 1;
|
||||
s += db_path_len;
|
||||
while (*s == '/') s++;
|
||||
|
||||
if (!*s)
|
||||
INTERNAL_ERROR ("Message filename was same as db prefix.");
|
||||
}
|
||||
|
||||
message->doc.set_data (s);
|
||||
|
|
Loading…
Reference in a new issue