Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mediaDetails sizes query returns incorrect value for "file" #2982

Open
2 of 3 tasks
philippahlfeld-netflow opened this issue Nov 5, 2023 · 4 comments
Open
2 of 3 tasks
Labels
Needs: Reproduction This issue needs to be reproduced independently. Type: Bug Something isn't working

Comments

@philippahlfeld-netflow
Copy link

philippahlfeld-netflow commented Nov 5, 2023

Description

Query to get mediaDetails size URL on any image returns a wrong file attribute. Return value is missing year/month segment and hence returns 404 when requested. The sourceUrl for however returns the corrects absolute url.

Steps to reproduce

Add New Post, set Featured image:

Query:

{
  post(id: "sample-post", idType: SLUG) {
    featuredImage {
      node {
        mediaDetails {
          sizes(include: THUMBNAIL) {
            file
            height
            width
          }
          height
          file
          width
        }
      }
    }
  }
}

Additional context

Output:

{
  "data": {
    "post": {
      "featuredImage": {
        "node": {
          "mediaDetails": {
            "sizes": [
              {
                "file": "sample-image-150x150.png",
                "height": "150",
                "width": "150",
                "sourceUrl": "https://sample.site/app/uploads/2023/11/sample-image-150x150.png"
              }
            ],
            "height": 797,
            "file": "2023/11/sample-image.png",
            "width": 1015
          }
        }
      }
    }
  },
  "extensions": {
    "debug": [],
    "graphqlSmartCache": {
      "graphqlObjectCache": []
    },
    "queryAnalyzer": {
      "keys": "7bce018bada4536cc202d7f1fcd3b8214c967eaa42e8afcd6c3be86cc4941c40 graphql:Query cG9zdDoxMDA1 cG9zdDoxMDA2",
      "keysLength": 104,
      "keysCount": 4,
      "skippedKeys": "",
      "skippedKeysSize": 0,
      "skippedKeysCount": 0,
      "skippedTypes": []
    }
  }
}

WPGraphQL Version

1.18.0

WordPress Version

6.3.2

PHP Version

8.1.18

Additional environment details

Using roots/sage ontop of bedrock for WP, which is the reason for the /app/ fragment in the returned URL: https://roots.io/

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for WPGraphQL.

  • Yes
  • My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.
@jasonbahl jasonbahl added the Needs: Reproduction This issue needs to be reproduced independently. label Nov 8, 2023
@jasonbahl
Copy link
Collaborator

jasonbahl commented Nov 8, 2023

@philippahlfeld-netflow what happens if you query for mediaItemUrl instead of sourceUrl?

Also, is there any specific permalink settings we should be aware of when trying to reproduce? Have you tried flushing your permalinks?

@philippahlfeld-netflow
Copy link
Author

@jasonbahl Can't query for mediaItemUrl inside sizes or mediaDetails,
Bildschirmfoto 2023-11-08 um 19 46 38

If you mean inside node, it returns https://sample.site/app/uploads/2023/11/sample-image.png

Permalink Settings
Bildschirmfoto 2023-11-08 um 19 48 38
Flushing or changing permalinks has no effect.

Also using roots/sage ontop of bedrock for WP, which is the reason for the /app/ fragment in the returned URL: https://roots.io/
However active theme is Twenty Twenty-Three.

@jasonbahl
Copy link
Collaborator

@philippahlfeld-netflow thanks for the added info! 🙌🏻

@jasonbahl jasonbahl reopened this Nov 8, 2023
@jasonbahl
Copy link
Collaborator

(didn't mean to close)

@justlevine justlevine added the Type: Bug Something isn't working label Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Reproduction This issue needs to be reproduced independently. Type: Bug Something isn't working
Projects
Status: 🗺 Planned
Development

No branches or pull requests

3 participants