open-nomad/ui/app/utils/escape-task-name.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

10 lines
273 B
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
export default function escapeTaskName(taskName) {
// Regular expression is taken from here: https://stackoverflow.com/a/20053121
return taskName.replace(/[^a-zA-Z0-9,._+@%/-]/gu, '\\$&');
}