puter
puter copied to clipboard
fix: improve onLaunchedWithItems to prevent information loss
[ai]
Fix for issue #1226: onLaunchedWithItems implementation to prevent information loss
This PR implements the solution suggested in issue #1226 to fix the problem with onLaunchedWithItems being prone to losing information about fsentries due to property duplication.
Changes:
-
Modified
launch_app.jsto only pass the file UUID to apps after granting the app permission to access the file:- Instead of passing all file properties through the URL query parameters, we now only pass the file UUID
- This eliminates the property duplication issue and keeps the URL shorter
-
Updated
UI.jsto haveonLaunchedWithItemsfetch the file information via puter.js:- When an app is launched with a file, it now uses
puter.fs.stat()to get the complete file information using the UUID - This ensures that all file properties are consistently retrieved from a single source
- When an app is launched with a file, it now uses
Benefits:
- More robust approach that eliminates property duplication
- Shorter URLs (avoids hitting URL length limits)
- Apps get the most up-to-date file information
- Consistent with how the rest of the system accesses file information
Fixes #1226
Manual test failed. This doesn't work because we are neither using /sign nor granting permission. Actually, we probably need to do both:
- writeURL, readURL etc provided by
/signneed to be present otherwise this is a regression - the new permission system should also be used however. Eventually we will migrate
/signso that it provides new endpoints for these URLs that behave the same but rely on the new permission system instead of signatures.
https://github.com/user-attachments/assets/3f468cb9-795c-4c91-9920-5119076aeb33