             #         @setState {files: currentFiles }
 
 
+getFileURL = (file) ->
+    if file.rawFileObject and not file.url
+        return URL.createObjectURL file.rawFileObject
+    file.url
 
 
 module.exports = FilePicker


    render: ->
        file = @props.file
        if not(file.url?) and not(file.rawFileObject)
            window.cozyMails.log(new Error "Wrong file #{JSON.stringify(file)}")
            file.url = "message/#{@props.messageID}/attachments/#{file.generatedFileName}"
        type = MessageUtils.getAttachmentType file.contentType

        @props.valueLink.requestChange files

    displayFile: (file) ->
        if (url = getFileURL file) window.open url + '?download=1'
        else console.log "broken file : ", file

    render: ->
