Skip to content

Logged out error modal pops up when downloading another user's sketch #3053

Closed
@lindapaiste

Description

@lindapaiste

p5.js version

No response

What is your operating system?

None

Web browser and version

No response

Actual Behavior

image

Expected Behavior

I should be able to download p5's sketch without any error.

The sketch actually does export successfully, using the saved version of the project.

We are getting this message because we make a PUT request to the API before exporting a sketch. That API request will fail if the user is not the owner of the sketch. The easiest solution would be to only make that API call if there is a logged in user and that user is the owner of the sketch.

The relevant code is here:

function downloadSketch() {
dispatch(autosaveProject());
exportProjectAsZip(project.id);
}

There is some nuance here with regards to how we would handle local/unsaved changes. Right now those changes would not be applied if it is not your sketch. This is part of a larger discussion happening in #2904.

Steps to reproduce

Steps:

  1. Make sure that you are logged out
  2. Go to a sketch which is not your own, such as https://editor.p5js.org/p5/sketches/Data:_True_and_False
  3. Click the "File" menu
  4. Click "Download"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions