Filemanager 7.2.1 and open action

Hi all,

I’ve another question regarding the new file manager. Currently, the open or downlaod action will open a new window; however, I need a Bearer token in order to access the file. How can I handle that? I don’t want to make the direct URL public… :slight_smile:

Thanks,
Martin

Please, can somebody responde on this? I need an urgen solution since I don’t want to open the download ULR for the public…

Hello @zevenbergm ,

File Manager allows quite complex customizations, so opening/downloading actions can be changed per any use-case.

The URL is generated by the Backend service (directLink method), the action itself (window.open) is performed in the corresponding method of Operation service.

The original code of the related methods is shown in the following snippet: Code Snippet

To change the way of opening/downloading, I would recommend changing the open and download operations to any suitable custom code.
Here’s an example of downloading a file without using window.open:

Code Snippet
In this snippet, webix.ajax returns data as a blob, then downloading is triggered with the related Webix method.

Considering the directLink method (which generates the initial URL), please note that the produced string URL is also used as a source for the media preview (line 40 in the 1st snippet). If you need to change this link as well, please make sure that Preview module will be able to process the changed link.

@zevenbergm the sources of File Manager will not only execute the script to define a new view for Webix, but also provides a global object that is required for correct init and mentioned customization.

Please try import the module as

import * as fileManager from "@xbs/filemanager";

Hi @Listopad,

Thank you for your extensive answer! One more question: I’m using the filemanager in a Webix Jet application. When I declare the customization class, I get an error that the fileManager not exists in the global namespace. What is the best way to import the fileManager in Webix Jet using webpack?

Thanks, Martin