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

picsum requests are outdated #418

Open
flimtix opened this issue Apr 4, 2022 · 5 comments
Open

picsum requests are outdated #418

flimtix opened this issue Apr 4, 2022 · 5 comments

Comments

@flimtix
Copy link

flimtix commented Apr 4, 2022

Version Information

Software Version(s)
Bogus NuGet Package 34.0.2

What is the expected behavior?

Expected is that Bogus will create a link based on the picsum.photos documentation.

https://picsum.photos/id/69/640/480

What is the actual behavior?

A link is created with ?image=id, which is outdated. It is possible that this request will not be possible anymore at some point.

https://picsum.photos/640/480/?image=69

Any possible solutions?

Specify the Id via the ULR and not as a parameter:

(Important: grayscale should be specified via a parameter, however, according to the docu...)

        public string PicsumUrl(int width = 640, int height = 480, bool grayscale = false, bool blur = false, int? imageId = null)
        {
            const string Url = "https://picsum.photos";

            var sb = new StringBuilder(Url);

            var n = imageId ?? this.Random.Number(0, 1084);
            sb.Append($"/id/{n}");

            sb.Append($"/{width}/{height}");

            if (grayscale)
            {
                sb.Append("?grayscale");
            }

            if (blur)
            {
                sb.Append(grayscale ? "&" : "?");
                sb.Append("blur");
            }

            return sb.ToString();
        }

How do you reproduce the issue?

Create a picsum link via Bogus.

Can you identify the location in Bogus' source code where the problem exists?

DataSet/Images.cs

sb.Append($"/?image={n}");

If the bug is confirmed, would you be willing to submit a PR?

No, because my recommended solution can already be found here in this report. Thus, this only needs to be added / overwritten.

@flimtix
Copy link
Author

flimtix commented Apr 4, 2022

In addition, the service lorempixel is no longer available / does not respond.

@bchavez
Copy link
Owner

bchavez commented Jul 22, 2022

I think we'll need to remove the LoremPixel service in our next major update. Thank you for reporting.

@prasadtelkikar
Copy link
Contributor

I will take this, will raise PR soon

@marijnz0r
Copy link
Contributor

@prasadtelkikar Have you found time to create the pull request to remove lorempixel.com from the codebase?
@bchavez I would like to contribute by removing lorempixel.com from the codebase altogether. Would this be appreciated?

@bchavez
Copy link
Owner

bchavez commented Jul 6, 2024

Hi @marijnz0r, yes I think removing LoremPixel.com is okay. I think the URLs and site have been broken for a long time.

Just a few more points:

  • Reference this GH issue number in your PR.
  • Keep the PR/change-set strictly focused on this kind of change (ie: don't include any code reformatting); keep the PR/changes strictly on topic. If you'd like to change something else off-topic; feel free to set up a new GH issue or PR for those off-topic changes and we can discuss. 👍

Thanks a bunch for your help.

@bchavez bchavez linked a pull request Jul 19, 2024 that will close this issue
@bchavez bchavez removed a link to a pull request Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants