Fixed and closed #467: names of new items are now trimmed before saving or renaming.
This commit is contained in:
parent
121f90fd9b
commit
f8e410bf6a
12 changed files with 35 additions and 2 deletions
|
@ -16,5 +16,5 @@ using System.Reflection;
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("3.0.1.461")]
|
[assembly: AssemblyVersion("3.0.1.462")]
|
||||||
[assembly: AssemblyFileVersion("3.0.1.461")]
|
[assembly: AssemblyFileVersion("3.0.1.462")]
|
||||||
|
|
|
@ -47,6 +47,8 @@ namespace ScrewTurn.Wiki {
|
||||||
lblNewCategoryResult.CssClass = "";
|
lblNewCategoryResult.CssClass = "";
|
||||||
lblNewCategoryResult.Text = "";
|
lblNewCategoryResult.Text = "";
|
||||||
|
|
||||||
|
txtNewCategory.Text = txtNewCategory.Text.Trim();
|
||||||
|
|
||||||
Page.Validate("newcat");
|
Page.Validate("newcat");
|
||||||
if(!Page.IsValid) return;
|
if(!Page.IsValid) return;
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,8 @@ namespace ScrewTurn.Wiki {
|
||||||
protected void btnCreate_Click(object sender, EventArgs e) {
|
protected void btnCreate_Click(object sender, EventArgs e) {
|
||||||
if(!Page.IsValid) return;
|
if(!Page.IsValid) return;
|
||||||
|
|
||||||
|
txtName.Text = txtName.Text.Trim();
|
||||||
|
|
||||||
lblResult.CssClass = "";
|
lblResult.CssClass = "";
|
||||||
lblResult.Text = "";
|
lblResult.Text = "";
|
||||||
|
|
||||||
|
|
|
@ -213,6 +213,8 @@ namespace ScrewTurn.Wiki {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void btnCreate_Click(object sender, EventArgs e) {
|
protected void btnCreate_Click(object sender, EventArgs e) {
|
||||||
|
txtName.Text = txtName.Text.Trim();
|
||||||
|
|
||||||
Page.Validate("namespace");
|
Page.Validate("namespace");
|
||||||
if(!Page.IsValid) return;
|
if(!Page.IsValid) return;
|
||||||
|
|
||||||
|
@ -412,6 +414,8 @@ namespace ScrewTurn.Wiki {
|
||||||
lblRenameResult.CssClass = "";
|
lblRenameResult.CssClass = "";
|
||||||
lblRenameResult.Text = "";
|
lblRenameResult.Text = "";
|
||||||
|
|
||||||
|
txtNewName.Text = txtNewName.Text.Trim();
|
||||||
|
|
||||||
Page.Validate("rename");
|
Page.Validate("rename");
|
||||||
if(!Page.IsValid) return;
|
if(!Page.IsValid) return;
|
||||||
|
|
||||||
|
|
|
@ -216,6 +216,8 @@ namespace ScrewTurn.Wiki {
|
||||||
protected void btnCreate_Click(object sender, EventArgs e) {
|
protected void btnCreate_Click(object sender, EventArgs e) {
|
||||||
if(!CanManagePagesInCurrentNamespace()) return;
|
if(!CanManagePagesInCurrentNamespace()) return;
|
||||||
|
|
||||||
|
txtName.Text = txtName.Text.Trim();
|
||||||
|
|
||||||
if(!Page.IsValid) return;
|
if(!Page.IsValid) return;
|
||||||
|
|
||||||
if(lstPages.Items.Count == 0) {
|
if(lstPages.Items.Count == 0) {
|
||||||
|
|
|
@ -132,6 +132,8 @@ namespace ScrewTurn.Wiki {
|
||||||
|
|
||||||
if(!Page.IsValid) return;
|
if(!Page.IsValid) return;
|
||||||
|
|
||||||
|
txtName.Text = txtName.Text.Trim();
|
||||||
|
|
||||||
if(txtCurrentElement.Value == "S") CreateSnippet();
|
if(txtCurrentElement.Value == "S") CreateSnippet();
|
||||||
else CreateTemplate();
|
else CreateTemplate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,6 +266,8 @@ namespace ScrewTurn.Wiki {
|
||||||
protected void btnCreate_Click(object sender, EventArgs e) {
|
protected void btnCreate_Click(object sender, EventArgs e) {
|
||||||
if(!Page.IsValid) return;
|
if(!Page.IsValid) return;
|
||||||
|
|
||||||
|
txtUsername.Text = txtUsername.Text.Trim();
|
||||||
|
|
||||||
lblResult.CssClass = "";
|
lblResult.CssClass = "";
|
||||||
lblResult.Text = "";
|
lblResult.Text = "";
|
||||||
|
|
||||||
|
|
|
@ -262,6 +262,8 @@ namespace ScrewTurn.Wiki {
|
||||||
if(canDelete) {
|
if(canDelete) {
|
||||||
lblRenameResult.Text = "";
|
lblRenameResult.Text = "";
|
||||||
|
|
||||||
|
txtNewName.Text = txtNewName.Text.Trim();
|
||||||
|
|
||||||
// Ensure that the extension is not changed (security)
|
// Ensure that the extension is not changed (security)
|
||||||
string previousExtension = Path.GetExtension(lblItem.Text);
|
string previousExtension = Path.GetExtension(lblItem.Text);
|
||||||
string newExtension = Path.GetExtension(txtNewName.Text);
|
string newExtension = Path.GetExtension(txtNewName.Text);
|
||||||
|
@ -274,6 +276,8 @@ namespace ScrewTurn.Wiki {
|
||||||
txtNewName.Text += previousExtension;
|
txtNewName.Text += previousExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txtNewName.Text = txtNewName.Text.Trim();
|
||||||
|
|
||||||
bool done = true;
|
bool done = true;
|
||||||
if(txtNewName.Text.ToLowerInvariant() != lblItem.Text.ToLowerInvariant()) {
|
if(txtNewName.Text.ToLowerInvariant() != lblItem.Text.ToLowerInvariant()) {
|
||||||
done = provider.RenamePageAttachment(CurrentPage, lblItem.Text, txtNewName.Text);
|
done = provider.RenamePageAttachment(CurrentPage, lblItem.Text, txtNewName.Text);
|
||||||
|
|
|
@ -497,6 +497,8 @@ namespace ScrewTurn.Wiki {
|
||||||
txtName.Text = GenerateAutoName(txtTitle.Text);
|
txtName.Text = GenerateAutoName(txtTitle.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txtName.Text = txtName.Text.Trim();
|
||||||
|
|
||||||
Page.Validate("nametitle");
|
Page.Validate("nametitle");
|
||||||
Page.Validate("captcha");
|
Page.Validate("captcha");
|
||||||
if(!Page.IsValid) {
|
if(!Page.IsValid) {
|
||||||
|
@ -708,6 +710,8 @@ namespace ScrewTurn.Wiki {
|
||||||
lblCategoryResult.Text = "";
|
lblCategoryResult.Text = "";
|
||||||
lblCategoryResult.CssClass = "";
|
lblCategoryResult.CssClass = "";
|
||||||
|
|
||||||
|
txtCategory.Text = txtCategory.Text.Trim();
|
||||||
|
|
||||||
Page.Validate("category");
|
Page.Validate("category");
|
||||||
if(!Page.IsValid) return;
|
if(!Page.IsValid) return;
|
||||||
|
|
||||||
|
|
|
@ -461,6 +461,9 @@ namespace ScrewTurn.Wiki {
|
||||||
protected void btnRename_Click(object sender, EventArgs e) {
|
protected void btnRename_Click(object sender, EventArgs e) {
|
||||||
lblRenameResult.Text = "";
|
lblRenameResult.Text = "";
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
|
txtNewName.Text = txtNewName.Text.Trim();
|
||||||
|
|
||||||
if(lblItem.Text.EndsWith("/")) {
|
if(lblItem.Text.EndsWith("/")) {
|
||||||
if(canDeleteDirs) {
|
if(canDeleteDirs) {
|
||||||
MovePermissions(CurrentDirectory + lblItem.Text, CurrentDirectory + txtNewName.Text);
|
MovePermissions(CurrentDirectory + lblItem.Text, CurrentDirectory + txtNewName.Text);
|
||||||
|
@ -487,6 +490,8 @@ namespace ScrewTurn.Wiki {
|
||||||
txtNewName.Text += previousExtension;
|
txtNewName.Text += previousExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txtNewName.Text = txtNewName.Text.Trim();
|
||||||
|
|
||||||
done = true;
|
done = true;
|
||||||
if(txtNewName.Text.ToLowerInvariant() != lblItem.Text.ToLowerInvariant()) {
|
if(txtNewName.Text.ToLowerInvariant() != lblItem.Text.ToLowerInvariant()) {
|
||||||
done = provider.RenameFile(CurrentDirectory + lblItem.Text, CurrentDirectory + txtNewName.Text);
|
done = provider.RenameFile(CurrentDirectory + lblItem.Text, CurrentDirectory + txtNewName.Text);
|
||||||
|
@ -519,6 +524,8 @@ namespace ScrewTurn.Wiki {
|
||||||
|
|
||||||
protected void btnNewDirectory_Click(object sender, EventArgs e) {
|
protected void btnNewDirectory_Click(object sender, EventArgs e) {
|
||||||
if(canCreateDirs) {
|
if(canCreateDirs) {
|
||||||
|
txtNewDirectoryName.Text = txtNewDirectoryName.Text.Trim();
|
||||||
|
|
||||||
lblNewDirectoryResult.Text = "";
|
lblNewDirectoryResult.Text = "";
|
||||||
txtNewDirectoryName.Text = txtNewDirectoryName.Text.Trim('/');
|
txtNewDirectoryName.Text = txtNewDirectoryName.Text.Trim('/');
|
||||||
AuthWriter.ClearEntriesForDirectory(provider, CurrentDirectory + txtNewDirectoryName.Text + "/");
|
AuthWriter.ClearEntriesForDirectory(provider, CurrentDirectory + txtNewDirectoryName.Text + "/");
|
||||||
|
|
|
@ -321,6 +321,8 @@ namespace ScrewTurn.Wiki {
|
||||||
ResizeImage();
|
ResizeImage();
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
|
txtNewName.Text = txtNewName.Text.Trim();
|
||||||
|
|
||||||
string targetName = chkNewName.Checked ? txtNewName.Text : Path.GetFileName(file);
|
string targetName = chkNewName.Checked ? txtNewName.Text : Path.GetFileName(file);
|
||||||
bool overwrite = !chkNewName.Checked;
|
bool overwrite = !chkNewName.Checked;
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,8 @@ namespace ScrewTurn.Wiki {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void cvUsername_ServerValidate(object source, ServerValidateEventArgs args) {
|
protected void cvUsername_ServerValidate(object source, ServerValidateEventArgs args) {
|
||||||
|
txtUsername.Text = txtUsername.Text.Trim();
|
||||||
|
|
||||||
if(txtUsername.Text.ToLowerInvariant().Equals("admin") || txtUsername.Text.ToLowerInvariant().Equals("guest")) {
|
if(txtUsername.Text.ToLowerInvariant().Equals("admin") || txtUsername.Text.ToLowerInvariant().Equals("guest")) {
|
||||||
args.IsValid = false;
|
args.IsValid = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue