VirtualBox

Changeset 79954 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jul 24, 2019 11:53:32 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132379
Message:

bugref:8344. Fixed a bug with an uppercase letter suffix in the image name (like ".VMDK").

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MediumImpl.cpp

    r79793 r79954  
    29922992                    destPath = sourcePath.stripFilename().append(RTPATH_SLASH).append(destFName);
    29932993                }
    2994                 suffix = i_getFormat();
    2995                 if (suffix.compare("RAW", Utf8Str::CaseInsensitive) == 0)
     2994
     2995                suffix = RTPathSuffix(sourceFName.c_str());
     2996
     2997                /* Suffix is empty and one is deduced from the medium format */
     2998                if (suffix.isEmpty())
    29962999                {
    2997                     DeviceType_T devType = i_getDeviceType();
    2998                     switch (devType)
     3000                    suffix = i_getFormat();
     3001                    if (suffix.compare("RAW", Utf8Str::CaseInsensitive) == 0)
    29993002                    {
    3000                         case DeviceType_DVD:
    3001                             suffix = "iso";
    3002                             break;
    3003                         case DeviceType_Floppy:
    3004                             suffix = "img";
    3005                             break;
    3006                         default:
    3007                             rc = setError(VERR_NOT_A_FILE,
    3008                                    tr("Medium '%s' has RAW type. \"Move\" operation isn't supported for this type."),
    3009                                    i_getLocationFull().c_str());
    3010                             throw rc;
     3003                        DeviceType_T devType = i_getDeviceType();
     3004                        switch (devType)
     3005                        {
     3006                            case DeviceType_DVD:
     3007                                suffix = "iso";
     3008                                break;
     3009                            case DeviceType_Floppy:
     3010                                suffix = "img";
     3011                                break;
     3012                            default:
     3013                                rc = setError(VERR_NOT_A_FILE,
     3014                                       tr("Medium '%s' has RAW type. \"Move\" operation isn't supported for this type."),
     3015                                       i_getLocationFull().c_str());
     3016                                throw rc;
     3017                        }
    30113018                    }
     3019                    else if (suffix.compare("Parallels", Utf8Str::CaseInsensitive) == 0)
     3020                    {
     3021                        suffix = "hdd";
     3022                    }
     3023
     3024                    /* Set the target extension like on the source. Any conversions are prohibited */
     3025                    suffix.toLower();
     3026                    destPath.stripSuffix().append('.').append(suffix);
    30123027                }
    3013                 else if (suffix.compare("Parallels", Utf8Str::CaseInsensitive) == 0)
    3014                 {
    3015                     suffix = "hdd";
    3016                 }
    3017 
    3018                 /* Set the target extension like on the source. Any conversions are prohibited */
    3019                 suffix.toLower();
    3020                 destPath.stripSuffix().append('.').append(suffix);
     3028                else
     3029                    destPath.stripSuffix().append(suffix);
    30213030            }
    30223031
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette