Skip to content

Enhance avatar API error handling and MIME type detection' & 'Refactor avatar API HTTP methods and improve error messages#163

Open
FireRat666 wants to merge 7 commits into
SideQuestVR:mainfrom
FireRat666:main
Open

Enhance avatar API error handling and MIME type detection' & 'Refactor avatar API HTTP methods and improve error messages#163
FireRat666 wants to merge 7 commits into
SideQuestVR:mainfrom
FireRat666:main

Conversation

@FireRat666

@FireRat666 FireRat666 commented May 24, 2026

Copy link
Copy Markdown

These changes at least fix it so the screenshot of the avatar is uploaded successfully and I see less errors in the logs due to the MimeType

Summary by CodeRabbit

  • Bug Fixes

    • Improved HTTP error messages to display response codes for better troubleshooting
    • Enhanced avatar upload reliability with improved error handling and state management
  • New Features

    • Added public visibility setting option for avatar slots
    • Automatic MIME type detection for file uploads

Review Change Stack

…ther it's a network issue, API outage, or actual problem with your request.
… for that endpoint. Removed the "PUT" parameter so it defaults to POST like the AttachAvatar method above it and Cover the web asset extensions that this uploader already sends
@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@FireRat666, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 1 review/hour. Refill in 50 minutes and 3 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 35e050d0-8f2c-4d06-98a8-81c0bf68b0c3

📥 Commits

Reviewing files that changed from the base of the PR and between 5984329 and 7cf20f7.

📒 Files selected for processing (1)
  • Editor/Resources/Builder/BuilderWindow.cs
📝 Walkthrough

Walkthrough

This PR enhances avatar upload and management by introducing public visibility support in the data model, switching avatar operations to PUT with explicit content-type handling, and improving the upload flow with better error messages and completion sequencing.

Changes

Avatar upload and API improvements

Layer / File(s) Summary
SqAvatarSlot data model with public visibility
Editor/Resources/Builder/SideQuest/SqEditorModels.cs
SqAvatarSlot adds an optional IsPublic field that serializes to JSON as is_public and ignores null values.
Avatar API operations and upload content handling
Editor/Resources/Builder/SideQuest/SqEditorAppApi.cs
UpdateAvatar and SelectAvatar switch from PATCH to PUT; file uploads now set explicit Content-Type headers using a new GetMimeType helper that maps file extensions (html, js, glb, gltf, images, zip, json, txt) to MIME types with application/octet-stream as fallback.
Avatar selection flow and HTTP error reporting
Editor/Resources/Builder/BuilderWindow.cs
JSON request errors now include HTTP response codes in exception messages; avatar selection after upload is explicitly coroutine-started with proper success and failure handlers that ensure the completion callback is always invoked even if selection fails.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • Ladypoly

Poem

🐰 Avatars dress in public flair,
PUT requests sail through the air,
Content types now labeled right,
Selection flows with error light—
The upload dance is smooth and clean! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title is compound and partially misaligned with the actual changes. While error handling and MIME type detection are addressed, the primary changes involve HTTP method refactoring (PUT→POST) and improved error messages, not just enhancement. The title is overly broad and the compound format ('&') makes it unclear which aspect is primary. Clarify the title to reflect the main change: consider 'Refactor avatar API HTTP methods and improve error handling' or 'Fix avatar upload with HTTP method refactoring and enhanced error messages' to better represent the changeset's primary focus.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@FireRat666

Copy link
Copy Markdown
Author

@coderabbitai review
I really don't understand the limit thing, Somehow it said I reached the limit when I made the first PR which was the First, there was no other, it made me wait for no reason, then when I tagged it to try to get it to review the new commits, it didn't do anything, so now when I submitted this PR, it didn't do anything because I tagged it earlier when it didn't do anything......

@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown

@FireRat666 I'm sorry for the confusion and frustration! I'll kick off the review of this PR right now.

To briefly explain what likely happened: rate limits are sometimes shared across an organization or repository, so if other PRs were being reviewed around the same time, it can appear like you hit a limit even on your first PR. When you tagged me on the existing commits while the limit was active, the command was consumed but nothing happened — and then the subsequent tag on the new PR was similarly dropped. I understand that's a poor experience, and I apologize for the confusion it caused.

(´• ω •`) 🐰

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Editor/Resources/Builder/BuilderWindow.cs`:
- Around line 1334-1342: The code dereferences slot.UserAvatarId inside the
EditorCoroutineUtility.StartCoroutine call (invoking sq.SelectAvatar) without
guarding slot for null; add a null check on slot before calling SelectAvatar and
handle the null case by recording the failure (status.AddStatus and
Debug.LogError) and ensuring callback() is invoked so completion flow always
runs; if slot is non-null, call sq.SelectAvatar as before with
slot.UserAvatarId. Ensure the checks wrap the call to
EditorCoroutineUtility.StartCoroutine and preserve the existing success and
error lambdas.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 15c3921b-2e31-425d-8b20-99bd954a2700

📥 Commits

Reviewing files that changed from the base of the PR and between a3107f1 and 5984329.

📒 Files selected for processing (3)
  • Editor/Resources/Builder/BuilderWindow.cs
  • Editor/Resources/Builder/SideQuest/SqEditorAppApi.cs
  • Editor/Resources/Builder/SideQuest/SqEditorModels.cs

Comment thread Editor/Resources/Builder/BuilderWindow.cs
@FireRat666 FireRat666 changed the title Refactor avatar API to use POST requests and enhance error handling Enhance avatar API error handling and MIME type detection' or 'Refactor avatar API HTTP methods and improve error messages May 24, 2026
@FireRat666 FireRat666 changed the title Enhance avatar API error handling and MIME type detection' or 'Refactor avatar API HTTP methods and improve error messages Enhance avatar API error handling and MIME type detection' & 'Refactor avatar API HTTP methods and improve error messages May 24, 2026
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.

1 participant