Fix #3962: Remove trailing slashes from path.
This commit is contained in:
parent
0a309fcbec
commit
6b960a4319
@ -181,11 +181,11 @@ static BOOL drive_file_remove_dir(const WCHAR* path)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void drive_file_set_fullpath(DRIVE_FILE* file, WCHAR* fullpath)
|
||||
static void drive_file_set_fullpath(DRIVE_FILE* file, const WCHAR* fullpath)
|
||||
{
|
||||
free(file->fullpath);
|
||||
file->fullpath = fullpath;
|
||||
file->filename = _wcsrchr(file->fullpath, 0x5c);
|
||||
file->filename = _wcsrchr(file->fullpath, L'/');
|
||||
|
||||
if (file->filename == NULL)
|
||||
file->filename = file->fullpath;
|
||||
|
@ -790,6 +790,7 @@ UINT drive_register_drive_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints,
|
||||
|
||||
if (name[0] && path[0])
|
||||
{
|
||||
size_t pathLength = strnlen(path, PATH_MAX);
|
||||
drive = (DRIVE_DEVICE*) calloc(1, sizeof(DRIVE_DEVICE));
|
||||
|
||||
if (!drive)
|
||||
@ -816,7 +817,10 @@ UINT drive_register_drive_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints,
|
||||
for (i = 0; i <= length; i++)
|
||||
Stream_Write_UINT8(drive->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
|
||||
if (ConvertToUnicode(sys_code_page, 0, path, -1, &drive->path, 0) <= 0)
|
||||
if ((pathLength > 0) && (path[pathLength-1] == '/'))
|
||||
pathLength --;
|
||||
|
||||
if (ConvertToUnicode(sys_code_page, 0, path, pathLength, &drive->path, 0) <= 0)
|
||||
{
|
||||
WLog_ERR(TAG, "ConvertToUnicode failed!");
|
||||
error = CHANNEL_RC_NO_MEMORY;
|
||||
|
Loading…
Reference in New Issue
Block a user