Overview

When you install SpiraTest, SpiraTeam or SpiraPlan on a server, you can either install it on the root of the webserver (in which case it will be http://server), or you can install it under a virtual director (e.g. http://server/SpiraTest or http://server/SpiraTeam). Similar for cloud customers, when you have a demo instance, your URL will be https://demo-us.spiraservice.net/myname and in production you would have https://myname.spiraservice.net).

Normally this doesn't matter. However if you paste images / screenshots into the rich text editors inside Spira, you will be embedding a relative URL that looks something like:

<img src="/Support/Attachment/46.aspx" style="height:1080px; width:1920px" />

this will be a problem if you change the URL of your server from SpiraTeam (in this example) to SpiraPlan. All the URLs will no longer work. Similar if you move from a demo cloud instance to a production once, you may get the same issue.

Solutions

One obvious solution is to just edit the IMG tags and fix the URLs. That can be time consuming and laborious, plus you may easily forget to fix certain ones manually. The good news is that there is another solution.

We have put together the following SQL that can be run to fix these kinds of issue. In this example we are going to fix the SAMPLE DATA rich text column of the TEST STEPs list, but it will work in the same way for the requirements, test cases, task, descriptions, etc:

WHILE 1 = 1 BEGIN
    WITH q AS
        (SELECT TEST_STEP_ID, PATINDEX('%<img src="/SpiraTeam/%', SAMPLE_DATA) AS n
        FROM TST_TEST_STEP)
    UPDATE TST_TEST_STEP
    SET SAMPLE_DATA = STUFF(SAMPLE_DATA, q.n, LEN('<img src="/SpiraTeam/'), '<img src="/SpiraPlan/')
    FROM q
    WHERE TST_TEST_STEP.TEST_STEP_ID = q.TEST_STEP_ID AND q.n != 0;

    IF @@ROWCOUNT = 0 BREAK;
END;

Note that in this example, we are changing SpiraTeam to SpiraPlan.

The equivalent code to switch SpiraTest to SpiraTeam would be:

WHILE 1 = 1 BEGIN
    WITH q AS
        (SELECT TEST_STEP_ID, PATINDEX('%<img src="/SpiraTest/%', SAMPLE_DATA) AS n
        FROM TST_TEST_STEP)
    UPDATE TST_TEST_STEP
    SET SAMPLE_DATA = STUFF(SAMPLE_DATA, q.n, LEN('<img src="/SpiraTest/'), '<img src="/SpiraTeam/')
    FROM q
    WHERE TST_TEST_STEP.TEST_STEP_ID = q.TEST_STEP_ID AND q.n != 0;

    IF @@ROWCOUNT = 0 BREAK;
END;

If you are cloud hosted, we can run these scripts for you to fix the data in the same way.