# Bug NEX-627 - OpenProject user avatar remains stale due to long browser cache

Project: Stream Nextcloud app "OpenProject Integration"
Status: closed
URL: https://community.openproject.org/work_packages/NEX-627

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | Nextcloud Integration 3.1.1 |
| Observed in versions |  |
| Bug found in version (deprecated) |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

1.  In `Nextcloud`, setup `integration_openproject` with `OAuth`.

2.  Connect the `Nextcloud` admin with an `OpenProject` admin.

3.  In `OpenProject`, navigate to  `Project settings > Files` of the `Demo Project` and add a file storage of type `Nextcloud`.

4.  In `Nextcloud`, select a file and navigate to sidebar `OpenProject` tab.

5.  Search for any of the work packages in the `Demo Project` and observe the avatar of the `OpenProject` admin.

6.  In `OpenProject`, navigate to `Account Settings -> Avatar` and change the avatar.

7.  In `Nextcloud`, refresh the page and observe the avatar of the `OpenProject` admin displayed in the `OpenProject` sidebar.

### What is the buggy behavior?

  - The old avatar continues to be displayed because the avatar endpoint response is cached by the `browser` for `24 hours`.
    
    Request:
    
    ``` bash
    GET https://nextcloud.local/ocs/v2.php/apps/integration_openproject/api/v1/avatar?userId=4&userName=OpenProject%20Admin
    ```
    
    Status Code:
    
    ``` bash
    200 OK (from disk cache)
    ```
    
    Cache header:
    
    ``` bash
    Cache-Control: private, max-age=86400, must-revalidate
    ```
    
    The `max-age=86400` header causes the browser to cache the avatar response for `24 hours`.
    
    If `Disable cache` is `enabled` in `DevTools` and the page is refreshed, the request is fetched again from the server:
    
    Request:
    
    ``` bash
    GET https://nextcloud.local/ocs/v2.php/apps/integration_openproject/api/v1/avatar?userId=4&userName=OpenProject%20Admin
    ```
    
    Status Code:
    
    ``` bash
    200 OK
    ```
    
    The updated avatar is then displayed correctly.

### What is the expected behavior?

  - Updated OpenProject avatars should be reflected in Nextcloud without requiring users to clear or disable their browser cache.

### Environment information

integration\_openproject `3.1.0`  
nextcloud `34`

**OpenProject installation type**

  - Docker-compose installation

**OpenProject version**

*If you're not running on the cloud edition, please specify the version of OpenProject you're running. Example: v12.1.5*

**Browser**

- [x] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Mobile Safari
- [ ] Other (please specify)

**Operating System**

- [ ] Windows
- [ ] Mac OS X
- [ ] Mobile iOS
- [ ] Mobile Android
- [x] Linux (please specify distro)
- [ ] Chrome OS
- [ ] Other (please specify)
