XFRM - Loading modal window - critical error

Sado Yasashii

Active member
Affected version
2.2.4
Hello.

Please pay attention!

When downloading files, most often 7z, rar, esp, esm etc. (any formats not listed in the XF), an error appears that it can not download and displays a message:
Oops! We ran into some problems.
Oops! We ran into some problems. Please try again later. More error details may be in the browser console.
Screen Shot 05-25-22 at 02.29 PM.JPG

The problem is not related to the work of the hosting/VPS - it is related to the work of the JavaScript code of the site (its execution does not depend on the server, JavaScript is executed on the user's computer). If you turn off JavaScript execution in your browser, the downloading starts, the video is available:
View attachment raidgame_net_jsdisabled.mov

If you look at the source code of the site (the code of the "Download" button), you can see that on the working page it looks like: (Example from my working forum)
Code:
<a href="/mods/poleznye-zaklinanija-utility-spells-uts.319/download" class="button--cta button--fullWidth button button--icon button--icon--download" target="_blank"><span class="button-text">Скачать
(<strong>5,8 МБ</strong> / <em>7z</em>)
</span></a>

On pages that are not working it looks like this: (Example from my working forum)
Code:
<a href="/mods/ragdolls.66/download" class="button--cta button--fullWidth button button--icon button--icon--download" target="_blank" data-xf-click="overlay"><span class="button-text">Скачать
  (<strong>1,4 МБ</strong> / <em>7z</em>)
</span></a>

In the second case, there is the parameter data-xf-click="overlay", which is processed by the browser and causes some JavaScript code to be executed.
Where the most important thing here is the data-xf-click="overlay" attribute.
By setting this attribute to an element that has an href (link), XF will automatically query the response to the link address asynchronously and show the result in a modal window.

It turns out that on pages where the file is not downloaded, the binary code of this file tries to be displayed through a modal window, and an error occurs. To solve this problem you need a fix from the developer.

From the UH Team came a proposal to solve the current problem through a template modifier:

Template: xfrm_resource_wrapper_macros
Modification key: remove_data_xf_click
Find:
data-xf-click="{{ $resource.CurrentVersion.file_count > 1 ? 'overlay' : '' }}"
Replace:
Empty

The solution removes the display of a modal window when downloading. If there is more than one file, it opens a new tab for downloading. This does not solve the problem of displaying a modal window, the problem is at the level of JavaScript. Let's hope you fix it.:)
 
Last edited:
Top