You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cli/src/models.rs
+3-10Lines changed: 3 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,6 @@
1
1
usecrate::util;
2
2
3
3
use anyhow::Context;
4
-
use regex::Regex;
5
4
use std::ffi::OsStr;
6
5
use std::fs;
7
6
use std::path::{Path,PathBuf};
@@ -147,7 +146,7 @@ impl Payload {
147
146
148
147
if !util::is_valid_extension_name(&extension_name){
149
148
returnErr(anyhow::anyhow!(
150
-
"invalid extension name detected {}",
149
+
"Invalid extension name detected: {}. It must begin with an alphabet, contain only alphanumeric characters or `_` and should be between 2 and 32 characters long.",
151
150
extension_name
152
151
));
153
152
}
@@ -226,16 +225,10 @@ impl ControlFileRef {
226
225
227
226
// Name of the extension. Used in the `create extesnion <extension_name>`
let name_regex = Regex::new(r"^[A-z][A-z0-9\_]{2,32}$").expect("regex is valid");
230
-
let name = self
231
-
.filename
228
+
self.filename
232
229
.strip_suffix(".control")
233
230
.context("failed to read extension name from control file")
234
-
.map(str::to_string)?;
235
-
if !name_regex.is_match(&name){
236
-
returnErr(anyhow::anyhow!("extension name must begin with an alphabet, contain only alphanumeric characters or `_` and should be between 2 and 32 characters long."));
237
-
}
238
-
Ok(name)
231
+
.map(str::to_string)
239
232
}
240
233
241
234
// A comment (any string) about the extension. The comment is applied when initially creating
0 commit comments