Upload to Cloudinary with .Net SDK - Invalid Signature

Open
#385 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
api, backend

Research direction

Start by reproducing the supplied C# example with Cloudinary.Upload, ImageUploadParams, AddCustomParam, and SignatureAlgorithm.SHA256. Compare the generated signature and server string to the documented upload parameters, then check how the SDK interprets Metadata versus custom parameters. Done means the documented metadata upload produces a valid signature and the request succeeds.

Written by the indexing model from the issue text.

Description

Bug report for Cloudinary .NET SDK

Before proceeding, please update to latest version and test if the issue persists

Describe the bug in a sentence or two.

When using the .NET SDK, it appears to not generate any signature. Additionally, my Cloudinary team requires metadata and the only way I can fulfill that requirement is with "addcustomparam" function.

Issue Type (Can be multiple)

  • Build - Cannot install or import the SDK
  • Performance - Performance issues
  • [ X ] Behaviour - Functions are not working as expected (such as generate URL)
  • [ X ] Documentation - Inconsistency between the docs and behaviour
  • Other (Specify)

Steps to reproduce

Account account = new Account("","","");
Cloudinary cloudinary = new Cloudinary(account);
cloudinary.Api.SignatureAlgorithm = SignatureAlgorithm.SHA256;

var uploadParams = new ImageUploadParams()
{
File = new FileDescription("IMG_2019.jpeg",File.OpenRead(file)),
UploadPreset = "",
Folder = ""
};

uploadParams.AddCustomParam("category","artwork");

var uploadResult = cloudinary.Upload(uploadParams);
Console.WriteLine(uploadResult.JsonObj);

Error screenshots or Stack Trace (if applicable)

When attempting to upload the file, the response is always: ""message": "Invalid Signature 6832973aae19f7f322bb88d48c7b34731c390f04cb9fafd5353ea5e5178639ea. String to sign - 'folder=&timestamp=1768517629&upload_preset='.""

If I try to set the Metadata in the ImageUploadParams() as the documentation suggests, I get the error that you cannot convert a "X" to a bool. the key work Metadata does not hold the same meaning though the documentation indicates it does.

OS and Version

  • Linux
  • [ X ] Windows
  • [ X ] macOS
  • MultiPlatform

Versions and Libraries (fill in the version numbers)

  • Cloudinary .NET SDK version - 1.27.9
  • .NET Core - 9.0.304
  • .NET Framework - n/a

Repository

I'm not sure on the repository. I can confirm that the same configuration works if I use the cloudinary-cli option.

If possible, please provide a link to a reproducible repository that showcases the problem

Dominant language
C#
Stars
105
Forks
72
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudinary/CloudinaryDotNet

All issues in cloudinary/CloudinaryDotNet

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.