Skip to content

Commit 3ab0e40

Browse files
Revert "Frontend: Display proper error message while updating profile (#4483)" (#4631)
This reverts commit 098b373.
1 parent b91b1fd commit 3ab0e40

File tree

2 files changed

+4
-42
lines changed

2 files changed

+4
-42
lines changed

frontend/src/js/controllers/profileCtrl.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,10 @@
177177
};
178178

179179
vm.isURLValid = function(url) {
180-
if (!url) {
181-
return true; // Allow empty URLs
180+
if (url === undefined || url === null) {
181+
return true;
182182
}
183-
var urlPattern = /^(https?:\/\/)?([\w-]+\.)+[\w-]+(\/[\w-._~:/?#[\]@!$&'()*+,;=]*)?$/;
184-
return url.length <= 200 && urlPattern.test(url);
183+
return (url.length <= 200);
185184
};
186185

187186
vm.editprofileDialog = function(ev) {
@@ -383,4 +382,4 @@
383382
};
384383
}
385384

386-
})();
385+
})();

frontend/tests/controllers-test/profileCtrl.test.js

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -313,41 +313,4 @@ describe('Unit tests for profile controller', function () {
313313
expect($rootScope.notify).toHaveBeenCalledWith("error", errorResponse.error);
314314
});
315315
});
316-
317-
describe('Unit tests for isURLValid function', function () {
318-
it('should allow empty URLs', function () {
319-
var result = vm.isURLValid('');
320-
expect(result).toBeTruthy();
321-
322-
result = vm.isURLValid(null);
323-
expect(result).toBeTruthy();
324-
325-
result = vm.isURLValid(undefined);
326-
expect(result).toBeTruthy();
327-
});
328-
329-
it('should return true for valid URLs within 200 characters', function () {
330-
var result = vm.isURLValid('https://github.com');
331-
expect(result).toBeTruthy();
332-
333-
result = vm.isURLValid('http://example.com/path?query=param');
334-
expect(result).toBeTruthy();
335-
336-
result = vm.isURLValid('https://sub.domain.example.com/long-path/to/resource?query=1&more=2');
337-
expect(result).toBeTruthy();
338-
});
339-
340-
it('should return false for invalid URLs or overly long ones', function () {
341-
var result = vm.isURLValid('invalid-url');
342-
expect(result).toBeFalsy();
343-
344-
result = vm.isURLValid('htp://missing-schema.com');
345-
expect(result).toBeFalsy();
346-
347-
var longUrl = 'http://example.com/' + 'a'.repeat(201);
348-
result = vm.isURLValid(longUrl);
349-
expect(result).toBeFalsy();
350-
});
351-
});
352-
353316
});

0 commit comments

Comments
 (0)