View Issue Details

IDProjectCategoryView StatusLast Update
0021687MMW 5Generalpublic2025-07-08 18:29
Reporterzvezdan Assigned To 
PriorityurgentSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Target Version2024.2Fixed in Version2024.2 
Summary0021687: getFolderOfPathAsync resolves with wrong drive/folder
Description1.
Let say that I have database containing only C: and D: in the Medias table. If I specify a root of some non-existent drive, e.g. X:\, I will get the folder object with the idMedia of the last drive from the Medias table and the id/persistentID of the corresponding root folder of that drive from the Folders table. I will get the same result for e.g. X:\jkfhdsfjk (a random string as filename).

If I specify a wrong path with a folder, e.g. X:\rlshjkdfjkdh\ (a random string as folder), I will get 0 for id and persistentID, but idMedia will be as in the previous case.

I expect in such situations getFolderOfPathAsync to reject, or to resolve with undefined, or, at least, not to returns idMedia/persistentID with the incorrect data, but 0.

2.
Let say that I have database containing only C: drive in the Medias table having old serial number, i.e. it is inaccessible (although I have a new C: drive with another serial number). If I use app.filesystem.getFolderOfPathAsync("c:\\"), it will resolve with id and persistentID = 0 and idMedia = -1.

I expect to get the idMedia of the old C: drive and id/persistentID with the corresponding id from the Folders table in database.

As you already know, the object returned by getFolderOfPathAsync() has objectType: "dbfolder", not "folder". I think getFolderFromString() is for that another case (your API is not very informative about it).
Steps To ReproduceYou could try it in Console:
await app.filesystem.getFolderOfPathAsync("x:\\")
TagsNo tags attached.
Fixed in build3163

Activities

Ludek

2025-07-08 11:33

developer   ~0079036

Fixed in 3163
image.png (24,066 bytes)   
image.png (24,066 bytes)   

Ludek

2025-07-08 11:36

developer   ~0079037

2) it will return idMedia of the new existing C:\\ now, and if it doesn't exists yet then it is inserted..
Or if C:\\ is assigned to the old idMedia (via Media Properties) then it will return the old..

zvezdan

2025-07-08 17:00

updater   ~0079040

> if it doesn't exists yet then it is inserted..

I am not sure that understand. Do you want to say that calling the mentioned function could add a new record into the Medias table? I think that would be quite unacceptable and there is no any reason for doing that. That function should return dbFolder object and nothing more.

Ludek

2025-07-08 17:11

developer   ~0079043

It adds new record just for the existing drives, if the drive doesn't exist then it returns 'folder not found'

zvezdan

2025-07-08 18:29

updater   ~0079046

What is the reason for adding a new record to the Medias table? This function should not alter the database at all. If I didn't report this problem, you wouldn't even think about doing that.