View Single Post
Old 12-27-2020, 09:22 AM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,047
Karma: 6361556
Join Date: Nov 2009
Device: many
All epub paths are bookpaths from the epub root so these should only use "/" as all hrefs do on all platforms.

Checked the actual code and I am happy that it handles things and only lets valid bookpaths through and \ is not a valid url or href character so I think the code does what it needs to here:

Code:
SelectFolder select_folder(group, m_Book, this);

    // Get the destination folder from the user
    if (select_folder.exec() != QDialog::Accepted) {
        return;
    }

    QString folder_path = select_folder.GetFolder();
    // Make sure folder_path is valid if abort
    bool valid_path = folder_path.indexOf("..") == -1;
    valid_path = valid_path && folder_path.indexOf("\\") == -1;
    valid_path = valid_path && !folder_path.startsWith("/");
    valid_path = valid_path && !folder_path.startsWith("./");
    valid_path = valid_path && !folder_path.startsWith(".");
    valid_path = valid_path && folder_path.indexOf("/.") == -1;
    valid_path = valid_path && !folder_path.startsWith("META-INF");
    valid_path = valid_path && folder_path.indexOf("META-INF") == -1;
    
    if (!valid_path) {
        Utility::DisplayStdErrorDialog(
	    tr("Destination Folder has invalid path \"%1\"").arg(folder_path));
	return;  
    }
If your destination already existed you would see its bookpath in the SelectFolder dialog and can see what types of paths it wants. The BookBrowser is not a generic File browser and as such uses / as its folder separator.

Last edited by KevinH; 12-27-2020 at 10:56 AM.
KevinH is offline   Reply With Quote