Skip to content

Conversation

scoder1747
Copy link
Contributor

@scoder1747 scoder1747 commented Oct 24, 2024

Summary

The existing picture-upload flow for Profile and Banner is broken. Root cause analysis of this bug is due to missing KeyPair parameter being passed while instantiating EditPictureControl objects. They KeyPair param is used to create nip98 signature and which is eventually used to create an "Authorization" header for creating an upload request.

Checklist

  • I have read (or I am familiar with) the Contribution Guidelines
  • I have tested the changes in this PR
  • My PR is either small, or I have split it into smaller logical commits that are easier to review
  • I have added the signoff line to all my commits. See Signing off your work
  • I have added appropriate changelog entries for the changes in this PR. See Adding changelog entries
    • I do not need to add a changelog entry. Reason: [Please provide a reason]
  • I have added appropriate Closes: or Fixes: tags in the commit messages wherever applicable, or made sure those are not needed. See Submitting patches

@jb55
Copy link
Collaborator

jb55 commented Oct 24, 2024

This looks right to me!

@jb55
Copy link
Collaborator

jb55 commented Oct 24, 2024

although nostr.build supports uploads without auth right? was it not working because the image was too large?

@scoder1747
Copy link
Contributor Author

although nostr.build supports uploads without auth right? was it not working because the image was too large?

I thought it would support but as of now, the following is the response sent by nostr-build
Upload Error: Unauthorized, please provide a valid nip-98 token

There is one more commit that limits the profile and banner upload to image only and sets selection quantity to 1

Comment on lines 122 to 129
if case .postView = mediaPickerEntry {
configuration.selectionLimit = 0 // Allows multiple media selection
configuration.filter = .any(of: [.images, .videos])
configuration.selection = .ordered // images are returned in the order they were selected + numbered badge displayed
} else if case .editPictureControl = mediaPickerEntry {
configuration.selectionLimit = 1 // Allows one media selection
configuration.filter = .images
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use switch statement

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jb55 I have made the update

Use Switch statement to address all cases instead of if-else

Signed-off-by: Swift Coder <[email protected]>
@alltheseas alltheseas added this to the 1.11 - lists milestone Oct 27, 2024
@jb55 jb55 closed this in a2b0620 Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants