You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
532 B
JavaScript

"use strict";
const isURL = require("@validatem/is-url");
const ignoreResult = require("@validatem/ignore-result");
const wrapError = require("@validatem/wrap-error");
const ValidationError = require("@validatem/error");
module.exports = wrapError("modular-matrix.is-mxc", "Must be a valid MXC URL", ignoreResult([
isURL([ "mxc://" ]),
function (value) {
if (value.hostname == null || value.pathname == null) {
return new ValidationError("Must be a valid MXC URL");
}
}
// TODO: Actually do the parsing here also?
]));