diff --git a/services/harmony/app/models/label.ts b/services/harmony/app/models/label.ts index deefa6ebc..8d930b9e6 100644 --- a/services/harmony/app/models/label.ts +++ b/services/harmony/app/models/label.ts @@ -1,14 +1,14 @@ import { Transaction } from '../util/db'; /** - * Returns an error message if a label is empty or exceeds 255 characters in length + * Returns an error message if a label exceeds 255 characters in length * * @param tag - The image tag to check * @returns An error message if the tag is not valid, null otherwise */ export function checkLabel(label: string): string { - if (label.length < 1 || label.length > 255) { - const message = 'Labels must consist of at least one 1 and no more than 255 characters.'; + if (label.length > 255) { + const message = 'Labels may not exceed 255 characters in length.'; return message; } return null; diff --git a/services/harmony/test/models/label.ts b/services/harmony/test/models/label.ts index c5d2b9553..6d4e673eb 100644 --- a/services/harmony/test/models/label.ts +++ b/services/harmony/test/models/label.ts @@ -26,11 +26,10 @@ describe('checkLabel', function () { it('should return an error message for invalid labels', function () { // Examples of invalid labels const invalidLabels = [ - '', // empty 'a'.repeat(256), // Exceeds maximum length ]; - const errorMessage = 'Labels must consist of at least one 1 and no more than 255 characters.'; + const errorMessage = 'Labels may not exceed 255 characters in length.'; invalidLabels.forEach(label => { const result = checkLabel(label); diff --git a/services/harmony/test/parameters/label.ts b/services/harmony/test/parameters/label.ts index 4e6904699..ad9ac3bd9 100644 --- a/services/harmony/test/parameters/label.ts +++ b/services/harmony/test/parameters/label.ts @@ -121,7 +121,7 @@ describe('labels', function () { }); it('returns a meaningful error message', async function () { - expect(this.res.text).to.include('Labels must consist of at least one 1 and no more than 255 characters'); + expect(this.res.text).to.include('Labels may not exceed 255 characters in length.'); }); }); }