custom function to form a url to download a document based on key
Asked Answered
F

1

6

i am using integrated document server 4.4.3 ubuntu based, bellow code is customized for my suitability, how can i form a url based on key

asc_docs_api.prototype.asc_customCallback     = function(typeFile, bIsDownloadEvent)
{

    var actionType =  c_oAscAsyncAction.DownloadAs;
    var options    = {downloadType : DownloadType.Download };
    this._downloadAs("save", typeFile, actionType, options, function(incomeObject){
    if (null != incomeObject && "save" == incomeObject["type"]) {

           //incomeObject["data"]  will return key of the document instead of key, i need full url of the document with md5 and expires like below 

           //ex: http://cache/files/.....


    });
};

thank you in advance

Faraday answered 18/9, 2017 at 7:13 Comment(0)
J
4

You are trying to get the link too early, the file is not yet available, the conversion process might not be completed. This callback only means that the conversion task is created

But you can try using the function onDownloadAs (created for the integrators who are going to create external button downloadAs) http://api.onlyoffice.com/editors/config/events#onDownloadAs A link to the file will be sent to: asc_docs_api.prototype.processSavedFile = function(url, downloadType)

Jennijennica answered 22/9, 2017 at 13:55 Comment(2)
what's the use of md5 and expires in url? download url is directly mapped in nginx with alias nameFaraday
We use md5 to protect the files in cache from brute force. For this purpose, we use nginx secure_link Please note that the url with md5 and expires should be created on the server side.Jennijennica

© 2022 - 2024 — McMap. All rights reserved.