Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why are there different ways for determining asset paths used and how to fix it? #506

Open
pawohl opened this issue Feb 9, 2020 · 1 comment
Labels

Comments

@pawohl
Copy link

pawohl commented Feb 9, 2020

  1. The paths on the Server for paella_logo.png is determined by calling paella.utils.folders.get('resources') without honoring paella.baseUrl.
  2. slide_professor_paella.jpg, icon_rotate.svg and minimize.svg are loaded through CSS without any reference to paella.baseUrl.
  3. others use paella.utils.folders.(profiles|resources|skins)() that prefix the path with paella.baseUrl.

This causes HTTP 404s when Paella is not installed in the root of the web application, for instance on https://github.com/studer-raimann/OpenCast/tree/master/node_modules/paellaplayer where Paella is served from /ilias.php?ref_id=IL_REF_ID&eid=UUID&cmd=streamVideo&cmdClass=xoctplayergui&cmdNode=uh:n4:158:15j&baseClass=ilrepositorygui while the code of Paella resides in /Customizing/global/plugins/Services/Repository/RepositoryObject/OpenCast/node_modules/paellaplayer/.

image
with relevant code being:

  function showLogos(logos) {
        // ..
        logoNode.domElement.setAttribute('src', "".concat(paella.utils.folders.get("resources"), "/style/").concat(logo.content));
        // ..

With the following result (several navigational images missing):
image

Is this something that should be fixed in Paella?

@pawohl pawohl added the question label Feb 9, 2020
@ferserc1
Copy link
Collaborator

The functions within paella.utils.folders only return the contents of the folders section in config.json file:

 "folders": {
    "profiles": "config/profiles",
    "resources": "resources",
    "skins": "resources/style"
  },

To get a complete path, you have to use these functions together with paella.baseUrl, which contains the URL where the current .html file is located, and is automatically initialized at upload time:

let fulResourceUrl = `${paella.baseUrl}/${paella.utils.folders.get("resources")}/`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants