diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index 13e5914d..41a58c92 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -69,6 +69,8 @@ * -> c:\silly "" * c:\silly * -> c:\silly "" + * C:\fixtures\2569067123_aca715a2ee_o.jpg + * -> C:\fixtures\2569067123_aca715a2ee_o.jpg "" * * vips8 handles this in a much better way :( */ @@ -109,7 +111,11 @@ im_filename_split( const char *path, char *name, char *mode ) break; } - if( *p == ':' ) { + /* Ignore a ':' in column 1, it's probably a drive letter on a + * Windows path. + */ + if( *p == ':' && + p - name != 1 ) { vips_strncpy( mode, p + 1, FILENAME_MAX ); *p = '\0'; } diff --git a/test/test_iofuncs.py b/test/test_iofuncs.py index 0f1bba44..2182cf9d 100755 --- a/test/test_iofuncs.py +++ b/test/test_iofuncs.py @@ -51,7 +51,10 @@ class TestIofuncs(unittest.TestCase): ""]], ["c:\\program files\\x:hello", ["c:\\program files\\x", - "hello"]] + "hello"]], + ["C:\\fixtures\\2569067123_aca715a2ee_o.jpg", + ["C:\\fixtures\\2569067123_aca715a2ee_o.jpg", + ""]] ] for case in cases: