Mercurial > octave
changeset 29215:6e031c8ed59c
maint: merge stable to default.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Tue, 22 Dec 2020 09:31:51 +0100 |
parents | 397d043bb2ff (current diff) 45abff4199d8 (diff) |
children | d50d9fd9ab05 |
files | liboctave/system/file-stat.cc |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/system/file-stat.cc Mon Dec 21 18:55:51 2020 +0100 +++ b/liboctave/system/file-stat.cc Tue Dec 22 09:31:51 2020 +0100 @@ -204,11 +204,13 @@ // If path is a root (like "C:" or "\\SERVER\share"), add a // trailing backslash. - // FIXME: Does this pattern match all possible UNC roots? - static const regexp pat (R"(^\\\\[\w-]*\\[\w-]*$)"); + // FIXME: This pattern does not match all possible UNC roots: + // https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/62e862f4-2a51-452e-8eeb-dc4ff5ee33cc + static const regexp pat (R"(^\\\\[\w.-]+\\[\w\$-]+$)"); if ((full_file_name.length () == 2 && full_file_name[1] == ':') - || pat.is_match (full_file_name)) - full_file_name += '\\'; + || (full_file_name.length () > 4 && full_file_name[0] == '\\' + && full_file_name[1] == '\\' && pat.is_match (full_file_name))) + full_file_name.push_back ('\\'); #endif const char *cname = full_file_name.c_str ();