Deleting pages with forward slashes

Hi

I used the ‘Copy’ command in xwiki to create a page, but didn’t specify the Copy location. It then created pages at the root of xwiki with forward slashes.

As shown in the picture.
xwiki_pages_with_forward_slashes

When viewing this page, it presented an error.
xwiki_viewing_pages_with_forward_slashes

Having read some content on the forum, i think it may be possible to replace the ‘view’ part of the url with ‘delete’ to remove a page
xwiki_replace_view_with_delete_on_page

But unfortunately, this didn’t work.

From looking at another topic on the forum - https://forum.xwiki.org/t/special-characters-in-page-titles/376, it suggests that changes have to be made in Tomcat to allow characters with forward slashes; and then it may be possible to delete the page. Or that it is necessary to modify and use a script, similar to the one on the page - https://snippets.xwiki.org/xwiki/bin/view/Extension/Delete%20page%20programatically/.

Is that correct?

As I’m trying to see what the options are for doing this.

Many thanks

Dan

If you can, make the modification to Tomcat. You do not have to delete the page; instead you can rename it / move it to the place where you want to have it.

If for some reason you cannot change the tomcat configuration then the code snippet to delete the page programmatically is the remaining option. (I think one can move/rename the page instead as well.)

Hi Daniel. I’d like more information in order to reproduce this.

  • Can you give the URL of a page on which you did the copy action?
  • You cannot not specify a location since by default the location is the current page. Can you explain in more details what you mean by “didn’t specify the Copy location”? FTR here’s what I see when I try the copy on A/B/C/:

04

And if you don’t change the “copy location” you’ll get a warning message that “Warning: The page A.B.C.WebHome already exists. Are you sure you want to overwrite it (all its content would be lost)?”. Did you get that and still clicked “copy”?

Thank you

FTR just tested on a badly configured Tomcat (i.e. where / and \ are forbidden) and the copy of A/B/C/ to itself was ok (no slashes added). Maybe you had “/” or “” characters in one of the pages that you copied?

Hi Vincent

Thanks for your replies.

There are 2 page with the problem
https://wiki.fortrus.com/bin/view/4%20-%20Admin%2FUnity%20Administrator%20Console%20(UAC)%2FDocuments/

and

https://wiki.fortrus.com/bin/view/4%20-%20Admin%2FUnity%20Administrator%20Console%20(UAC)%2FSmall%20Tables/

In relation to another question you mentioned ‘… Can you explain in more details what you mean by “didn’t specify the Copy location”? FTR here’s what I see when I try the copy on A/B/C/…’

For this I changed the page name, but I forgot to change the copy location and then I used the copy button.

As shown i the attached diagram.

copying_page_without_changing_location

For you last question ‘…Maybe you had “/” or “” characters in one of the pages that you copied?..’ I don’t think i did that, but it is possible. :blush:

Actually you do :slight_smile: You mentioned the following 2 URLs:

And

The %2F character means a /.So if your Tomcat wasn’t properly configured that could explain the problems you had.

Have you changed the Tomcat config to support ‘/’ and '`?

Yes but when you do this, you get a warning saying that you’re going to overwrite a page… So it means you also clicked “copy” to overwrite the page I guess :slight_smile:

I’ll try to find the time to retry with a badly configured Tomcat and a page having a “/” in the name.

In any case if you’ve configured Tomcat correctly, you shouldn’t have the problem anymore.

Hi

Just to confirm that we applied the fix suggested of updating tomcat environmental variables and it is now possible to delete pages.

Kind regards

Dan

Excellent, thanks for posting back!