MCPcopy Create free account
hub / github.com/dajie111/nodeseek-userscript / validateImageFile

Function validateImageFile

nodeImage.js:537–547  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

535 }
536 }
537 function validateImageFile(file) {
538 if (!file) return '请选择图片文件';
539 if (file.size > MAX_BYTES) return '文件超过 100MB 限制';
540 var ok = ALLOWED_MIME.test(file.type || '');
541 if (!ok) {
542 var n = (file.name || '').toLowerCase();
543 if (/\.(jpe?g|png|gif|webp)$/i.test(n)) ok = true;
544 }
545 if (!ok) return '仅支持 JPG、JPEG、PNG、GIF、WebP';
546 return '';
547 }
548 function fileDisplayNameForTip(file) {
549 var n = (file && file.name) || '未命名';
550 n = String(n).replace(/[\r\n\u0000]+/g, ' ').trim() || '未命名';

Callers 3

partitionUploadFilesFunction · 0.85
runUploadFunction · 0.85
nodeImage.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected