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

Kalaiselvan
  • 2,095
  • 1
  • 18
  • 31

1 Answers1

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)

ibnpetr
  • 472
  • 2
  • 5
  • what's the use of md5 and expires in url? download url is directly mapped in nginx with alias name – Kalaiselvan Sep 25 '17 at 06:23
  • We use md5 to protect the files in cache from brute force. For this purpose, we use [nginx secure_link](http://nginx.org/en/docs/http/ngx_http_secure_link_module.html) Please note that the url with md5 and expires should be created on the server side. – ibnpetr Sep 26 '17 at 08:19