dosubot[bot] commented on issue #29965:
URL: https://github.com/apache/superset/issues/29965#issuecomment-2295216359

   <!-- Greeting -->
   Hey @huandu, I'm here to help you with any bugs, questions, or contributions 
you might have for the repository. Let me know how I can assist you! 😊
   
   <!-- Answer -->
   The issue arises because the `UIManifestProcessor.get_manifest` method does 
not prepend the `STATIC_ASSETS_PREFIX` to the asset paths. The method currently 
returns paths like `"/static/dist/main-js.js"` and 
`"/static/dist/main-css.css"` without the prefix, even when 
`STATIC_ASSETS_PREFIX` is set.
   
   Here's the relevant part of the implementation:
   
   ```python
   def get_manifest(self) -> dict[str, Callable[[str], list[str]]]:
       loaded_chunks = set()
   
       def get_files(bundle: str, asset_type: str = "js") -> list[str]:
           files = self.get_manifest_files(bundle, asset_type)
           filtered_files = [f for f in files if f not in loaded_chunks]
           for f in filtered_files:
               loaded_chunks.add(f)
           return filtered_files
   
       return {
           "js_manifest": lambda bundle: get_files(bundle, "js"),
           "css_manifest": lambda bundle: get_files(bundle, "css"),
           "assets_prefix": self.app.config["STATIC_ASSETS_PREFIX"]
           if self.app
           else "",
       }
   ```
   
   The `assets_prefix` is correctly set in the returned dictionary, but it is 
not applied to the individual asset paths. This discrepancy leads to the URLs 
of scripts and CSS files missing the configured prefix 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/extensions/__init__.py)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/tests/unit_tests/extension_tests.py)</sup>.
   
   To fix this, you would need to modify the `get_files` function to prepend 
the `STATIC_ASSETS_PREFIX` to each asset path.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to