Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PATCH not working in Transactions #267

Closed
wants to merge 2 commits into from
Closed

Fix PATCH not working in Transactions #267

wants to merge 2 commits into from

Conversation

kaimst
Copy link
Contributor

@kaimst kaimst commented Mar 17, 2014

String txId = getCurrentTransactionId(session);
if (txId != null) {
String txIdWithSlash = "/" + txId;
pathToValidate = StringUtils.removeStart(txIdWithSlash, absPath);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is removeStart() called on "/txId" for the case when the transaction is working against the root? i.e. when absPath equals "/"?
If some, please add a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base URL is removed, take a look at the contstructor of this class. That means the URL here is always context relative. http://localhost:8080/tx:... works as well as http://localhost:8080/abc/tx:... as long as tx is the first thing after the context.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running the debugger on this, it seems that line:231 always results in pathToValidate equaling txIdWithSlash. What is the scenario where "removeStart()" comes into play?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I accidentially swapped the parameters. Sorry for the trouble. Will write a unit test.

@kaimst kaimst closed this Mar 19, 2014
@kaimst kaimst deleted the fcrepo-66262856 branch March 19, 2014 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants