Skip to content

fix: improve onLaunchedWithItems to prevent information loss #1230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KernelDeimos
Copy link
Contributor

[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:

  1. Modified launch_app.js to 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
  2. Updated UI.js to have onLaunchedWithItems fetch 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

Benefits:

  1. More robust approach that eliminates property duplication
  2. Shorter URLs (avoids hitting URL length limits)
  3. Apps get the most up-to-date file information
  4. Consistent with how the rest of the system accesses file information

Fixes #1226

- Modified launch_app.js to only pass file UUID to apps\n- Updated UI.js to fetch complete file information using puter.fs.stat()\n- Ensures consistent file information and avoids URL length limitations\n\nFixes #1226

ai: true
@KernelDeimos
Copy link
Contributor Author

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 /sign need to be present otherwise this is a regression
  • the new permission system should also be used however. Eventually we will migrate /sign so that it provides new endpoints for these URLs that behave the same but rely on the new permission system instead of signatures.
pr-1230_1.5x.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

onLaunchedWithItems is prone to losing information about fsentries
1 participant