UDM causes app to crash if passed a empty download url

Bug #1557771 reported by Nekhelesh Ramananthan on 2016-03-15
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical System Image
High
Bill Filler
ubuntu-download-manager
Fix Released
Undecided
Michael Sheldon

Bug Description

Here is a sample app, that if you run and press "Tap me" will cause the app to crash. It is understandable that UDM doesn't accept empty urls, but I would expect it to gracefully output a error message rather than cause the whole app to crash.

import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.DownloadManager 1.2

MainView {
    id: mainView

    objectName: "mainView"
    applicationName: "downloadmanager.unknown"

    width: units.gu(100)
    height: units.gu(75)

    Page {
        title: i18n.tr("DownloadManager")

        Column {
            id: mainColumn

            spacing: units.gu(1)
            anchors {
                margins: units.gu(2)
                fill: parent
            }

            Label {
                id: label
                objectName: "label"
                text: i18n.tr("Hello..")
            }

            Button {
                objectName: "button"
                width: parent.width

                text: i18n.tr("Tap me!")

                onClicked: {
                    for (var i=0; i<10; i++) {
                        var singleDownload = downloadComponent.createObject(mainView, {"title": "Solar Project " + i})
                        singleDownload.download("")
                    }
                }
            }

            Component {
                id: downloadComponent
                SingleDownload {
                    id: downloader
                    property string title
                    metadata: Metadata {
                        showInIndicator: true
                        title: downloader.title
                    }
                }
            }

            ListView {
                width: parent.width
                height: parent.height
                model: downloadManager.downloads
                delegate: Row {
                    width: parent.width
                    height: units.gu(4)
                    Label {
                        id: titleLabel
                        text: modelData.title
                    }

                    ProgressBar {
                        width: parent.width - titleLabel.implicitWidth
                        height: parent.height
                        maximumValue: 100
                        value: modelData.progress
                    }
                }
            }

            DownloadManager {
                id: downloadManager
                cleanDownloads: true

                onDownloadFinished: {
                    label.text += "\nFinished: " + path
                }
            }
        }
    }
}

Related branches

Changed in canonical-devices-system-image:
status: New → Fix Committed
importance: Undecided → High
assignee: nobody → Bill Filler (bfiller)
milestone: none → ww08-2016
Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
Changed in ubuntu-download-manager:
status: New → Fix Released
assignee: nobody → Michael Sheldon (michael-sheldon)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers