open-ux-tools icon indicating copy to clipboard operation
open-ux-tools copied to clipboard

BUG - @sap-ux/ui5-proxy-middleware directLoad not working

Open zinserjan opened this issue 1 year ago • 1 comments

Related Feature

Feature request: -

Description

  • directLoad: true does not work and fails with Error: EISDIR: illegal operation on a directory, read

Steps to Reproduce

Steps to reproduce the behavior:

  1. use directLoad: true in @sap-ux/ui5-proxy-middleware
  2. Open /index.html or /test/flpSandbox.html
  3. See error

Expected results

  • no Error
  • URLs are replaced

Actual results

  • Error: EISDIR: illegal operation on a directory, read

Version/Components/Environment

Add any other context about the problem here

OS:

  • [ ] Mac OS
  • [x] Windows
  • [ ] Other

Node.js v20.16.0

Packages:

  • @ui5/cli v4.0.3
  • @sap-ux/ui5-proxy-middleware v1.4.3

Root Cause Analysis

Problem

  • req.baseUrl is here always an empty string https://github.com/SAP/open-ux-tools/blob/c0f92980c658ad2fc9f28de75b3e778d5fa36559/packages/ui5-proxy-middleware/src/base/utils.ts#L275-L280
  • htmlFilePath will be just the webapp folder instead of the path to the requested HTML file
  • that's why the further logic doesn't work and instead of replacing the URL in injectUI5Url it tries to read the webapp directory

Fix

  • just use reg.url or reg.originalUrl

zinserjan avatar Aug 06 '24 14:08 zinserjan

@cfg74 could you please plan to get this one fixed.

tobiasqueck avatar Aug 19 '24 08:08 tobiasqueck