snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.04k stars 3.18k forks source link

User Images show as broken links. Snipe-IT installed in sub-directory #10990

Open jnichel opened 2 years ago

jnichel commented 2 years ago

Debug mode

Describe the bug

I have Snip-IT installed in a sub-directory of our company Intranet. Followed the instructions for doing this and everything seems to have gone fine and the tool is working for the most part. The only issue is user images; for whatever reason, the code is not seeing the sub-directory for these images. When I look at the source code for the user details page, I see this:

<img src="/uploads/avatars/user-avatar-S1KaoEiQqc.jpg" class="avatar img-thumbnail hidden-print" alt="Test User">

The problem is, the URI should be /assets/uploads/avatars/user-avatar-S1KaoEiQqc.jpg

The image shows up fine when you try to edit the user however.

Reproduction steps

  1. Install Snipe-IT in a sub-directory (assets for me)
  2. Create new user and upload image for user
  3. View user details page (broken image will be there) ...

Expected behavior

I would expect the tool to use the sub-directory as its document root throughout the site. User details page is the only place I've noticed this so far.

Screenshots

No response

Snipe-IT Version

5.3.10

Operating System

CentOS Stream release 8

Web Server

Apache/2.4.37

PHP Version

PHP 7.4.29

Operating System

Windows 10 Professional

Browser

Firefox and Chrome

Version

97.0.2 (FF) & 100.0.4896.127 (Chrome)

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

Fresh install vi Git Clone Manual install Just setting it up at the moment; adding company, users, departments, etc. No error messages Have not manually edited the database

snipe commented 2 years ago

What do you have at your APP_URL in your .env?

jnichel commented 2 years ago

Sorry, I should have included that in the original post.

APP_URL='https://intranet.kegworks.com/assets'

KegWorks Asset Management
JemCdo commented 2 years ago

Can you try to change the line into

<img src="{{ asset('/uploads/avatars/user-avatar-S1KaoEiQqc.jpg')}}" class="avatar img-thumbnail hidden-print" alt="Test User">

jnichel commented 2 years ago

@JemCdo Thank you for the response. Where do I change this line? When I said I look at the source code for the user details page in my original post, I'm talking about the processed page in the browser; right click -> View Page Source. That is not editable.

snipe commented 2 years ago

You shouldn't have to change anything in the code though.