Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

added url parsing to allow query params in urls #434

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

digitalLumberjack
Copy link

@digitalLumberjack digitalLumberjack commented Aug 17, 2017

Closes #434

Url is now parsed and query params are removed when checking for file extension.

The remaining issue is if someone would use query params to specify the file like htttps://mysditribution.com/download?file=root.tar.xz

What do you think ?

@XECDesign
Copy link
Contributor

The change looks good to me. Has it been tested?

@digitalLumberjack
Copy link
Author

Just thought about something, should we also support that for marketing, os_info and partitions files ?

@digitalLumberjack
Copy link
Author

For now, I tested with a os_v3.json like this one :

{
    "os_list": [
	{
            "description": "Recalbox, the open source retro gaming console for rpi1!",
            "icon": "https://install.recalbox.com/v1/noobs/recalboxOS.png",
            "marketing_info": "https://install.recalbox.com/v1/noobs/marketing.tar",
            "nominal_size": 2048,
            "os_info": "https://install.recalbox.com/v1/noobs/rpi1/os.json",
            "os_name": "recalboxOS-rpi1",
            "partition_setup": "https://install.recalbox.com/v1/noobs/partition_setup.sh",
            "partitions_info": "https://install.recalbox.com/v1/noobs/partitions.json",
            "release_date": "2016-11-26",
            "supported_hex_revisions": "2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,19,0092,0093",
            "supported_models": [
                "Pi Model",
                "Pi Compute Module",
                "Pi Zero"
            ],
            "tarballs": [
                "https://install.recalbox.com/v1/noobs/rpi1/boot.tar.xz?source=noobs",
                "https://install.recalbox.com/v1/noobs/rpi1/root.tar.xz?source=noobs"
            ]
        }
    ]
}

@XECDesign
Copy link
Contributor

It would make sense to be consistent, but I don't have any strong feelings one way or another.

if (isURL(tarball))
QString tarballPath = QString(tarball);
if (isURL(tarball)){
tarballPath = QUrl::fromUserInput(tarball).toString(QUrl::RemoveQuery);
cmd += "wget --no-verbose --tries=inf -O- "+tarball+" | ";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might need to escape shell arguments if you are going to allow query parameters.
While ? does not have special meaning to shell, other characters that may appear such as & do.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants