Skip to content

Local directory image file analysis integration#5

Open
AtolagbeMuiz wants to merge 3 commits into
Ezeji:masterfrom
AtolagbeMuiz:local_image_file_analysis_integration
Open

Local directory image file analysis integration#5
AtolagbeMuiz wants to merge 3 commits into
Ezeji:masterfrom
AtolagbeMuiz:local_image_file_analysis_integration

Conversation

@AtolagbeMuiz

Copy link
Copy Markdown

Brief Implementation Explanation

This implementation extends your original image analysis API to handle both URL-based and local file system images:

Core Modifications

Flexible Path Detection:

  • IsUrl() method checks if input is a web URL or local file path.
  • Routes to appropriate analysis method based on input type.

Local File Analysis:

  • AnalyzeImageFromLocalFile() reads images from disk using FileStream.
  • Uses AnalyzeImageInStreamAsync() instead of URL-based analysis.
  • Validates file existence and supported formats (.jpg, .png, etc.)

@gitguardian

gitguardian Bot commented Jul 29, 2025

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
5571975 Triggered SendGrid Key 2e7aba5 appsettings.json View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Comment thread Helpers/Helpers.cs

namespace AnalyzeImageAPI.Helpers
{
public class Helpers

@Ezeji Ezeji Aug 4, 2025

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make Helpers a static class or provide an interface for it, preferrably a static class since we don't really need to inject it in DI. We can as well do away with the DI instantiation in the Startup.cs.

@Ezeji Ezeji left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good addition from this PR,

Just one major request, given the extension of the current codebase and to make it more better for contribution, can you also include in this PR the following:

  • Refactor the codebase so that it is cleaner by removing business rules to a service layer. (Api layer, Core layer, Repository layer and Tests layer). Here's a sample structure you can consider to keep it super simple: https://github.com/Ezeji/StraddleService
  • Write unit tests for the service methods. Consider using Nsubstitute library for mocking and Xunit as the test framework.
  • Upgrade to .NET 9.0 if possible and preferrably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants