irods-contrib / metalnx-web

Metalnx Web Application
https://metalnx.github.io/
BSD 3-Clause "New" or "Revised" License
36 stars 36 forks source link

recent encoding/decoding path error in collection browser #271

Closed connectbo closed 2 years ago

connectbo commented 2 years ago

I have a collection called thumbnails-test2 under /tempZone/home/rods. Collection browser renders correct when I click collection in the sidebar.

image

But when I click thumbnails-test2 collection and it brings this error:

image

Notice the path param in url is %252FtempZone%252Fhome%252Frods%252Fthumbnails-test2.

@korydraughn Can you reproduce this error and share some thoughts on this? Not sure if it is related to path decoding/encoding.

korydraughn commented 2 years ago

I will take a look.

yr-wang-hit commented 2 years ago

The same question. The version of current master is fairly unstable. before I pull the code to current master. the AVUSearch functionality is unavailable. And now as bo said, the click of collection leads to an error page. And the encoding/decoding [UTF-8 character support and path redirect] support is fairly poor.

korydraughn commented 2 years ago

The AVU search and Property search UIs were combined into one. The UI was adjusted to be closer to how iquest works. Are you saying the search UI isn't appearing or generating an error?

I will look into fixing the the encoding/decoding issue.

trel commented 2 years ago
metalnx_1  | 2021-08-31 12:16:48 INFO  CollectionServiceImpl:169 - isDataObject()
metalnx_1  | 2021-08-31 12:16:48 INFO  CollectionServiceImpl:149 - isCollection()
metalnx_1  | 2021-08-31 12:16:48 INFO  CollectionServiceImpl:154 - getting objStat
metalnx_1  | 2021-08-31 12:16:48 INFO  IRODSServicesImpl:252 - getCollectionAndDataObjectListAndSearchAO()
metalnx_1  | 2021-08-31 12:16:48 INFO  CollectionListingUtils:1180 - got a file not found, try to heuristically produce an objstat
metalnx_1  | 2021-08-31 12:16:48 INFO  CollectionListingUtils:172 - handleNoObjStatUnderRootOrHomeByLookingForPublicAndHome()
metalnx_1  | 2021-08-31 12:16:48 INFO  CollectionListingUtils:259 - really is a not found for file:%2FtempZone%2Fhome%2Frods%2Fthumbnails
metalnx_1  | 2021-08-31 12:16:48 ERROR CollectionServiceImpl:161 - error getting objStat
metalnx_1  | org.irods.jargon.core.exception.FileNotFoundException: unable to find file under path
korydraughn commented 2 years ago

I was able to reproduce this. The path being sent to the server is being encoded twice.

encode("%2FtempZone%2Fhome%2Frods%2Fmy-coll-test2") ==> "%252FtempZone%252Fhome%252Frods%252Fmy-coll-test2"

We just need to find out where the extra call to encode is happening. My guess is that it is happening in the client-side.

korydraughn commented 2 years ago

The issue is the call to positionBrowserToPath(). The following was taken from the browser's console output:

positionBrowserToPath()
Navigated to http://kdd-ws.europa.renci.org/metalnx/collections?path=%252FtempZone%252Fhome%252Frods%252Fmy-coll-test2
korydraughn commented 2 years ago

The onclick handler is passing an encoded path to the positionBrowserToPath function. positionBrowserToPath always encodes the incoming string. If we adjust the onclick handler, I think that will take care of it.

trel commented 2 years ago

this must have ... changed recently?

korydraughn commented 2 years ago

There used to be a call to decode in the server. I removed that to fix an issue (spring automatically decodes values in certain situations). I believe that exposed this issue.

trel commented 2 years ago

okay - good.

since we don't have automated selenium testing - we'll need to click around most of the application to make sure this didn't creep in somewhere else too.

korydraughn commented 2 years ago

I have a solution for this. Once I've gone through and found all instances of this, I'll create the PR.