Updates aroudn URI handling

Added test to get attachment from old revision
Fixed handling around query parameters and attachment url