Skip to content

[Bug]: API unable to set users avatar #18311

@AdamKearn

Description

@AdamKearn

Snipe-IT Version

v8.3.6 - build 20551

PHP Version

8.2.29

Composer Version

2.8.12

MySQL/MariaDB version

Ver 15.1 Distrib 10.11.14-MariaDB

How did you install Snipe-IT?

Git install

Is this a fresh install or an upgrade?

Fresh install

What happened?

When calling the API (PATCH request)

$body=@{}
$body.Add("avatar", "$($staffMember.employee_num).png")

Invoke-WebRequest -UseBasicParsing -Uri "${SNIPE_ENDPOINT}/users/1" -Method PATCH -Headers $snipe_headers -ContentType 'application/json' -Body ($body | ConvertTo-Json)

This returns the following repsonce:

{"status":"error","messages":{"avatar":["The avatar field must be a file of type: png, gif, jpg, jpeg, svg, bmp, svg+xml, webp, avif."]},"payload":null}

I'm currently syncing my users images from 365 using another PowerShell script into the /public/avatars folder.
When typing the employee_num.png into the database manually, it will work... is there any reason why this would not be an accepted value?

I've even tried doing the full HTTP URL of the image too.

What browsers are you seeing the problem on?

Microsoft Edge

Can you reproduce this on the public demo?

N/A

Do you have full multiple company support enabled?

Yes

If you have full multiple company support enabled, do you have location scoping to company enabled?

Yes

Application log output

Browser console output

Common Issues

  • I have searched this repo for existing issues related to my issue (including closed issues)
  • My APP_URL is set correctly in my .env file (including http or https and no trailing slash)
  • I have searched the official Snipe-IT documentation and have checked the Common Issues documentation (where applicable)
  • I have run database migrations (where applicable).
  • I have attached screenshots and/or videos of the issue (where applicable)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions