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

QueueBrowser: QueueItems with index higher than 99 cannot be loaded #49

Closed
mcweba opened this issue Jul 1, 2016 · 1 comment
Closed
Labels

Comments

@mcweba
Copy link
Collaborator

mcweba commented Jul 1, 2016

In the QueueBrowser class is a mapping for GET requests to load a single QueueItem by index.

GET /playground/queues/my_queue/{index}

This mapping is implemented as follows:

// Get item
router.getWithRegex(prefix + "/queues/([^/]+)/[0-9]+").handler(ctx -> {
    final String queue = lastPart(ctx.request().path().substring(0, ctx.request().path().length() - 2), "/");
    final int index = Integer.parseInt(lastPart(ctx.request().path(), "/"));
    eb.send(redisquesAddress, buildGetQueueItemOperation(queue, index), new Handler<AsyncResult<Message<JsonObject>>>() {
        @Override
        public void handle(AsyncResult<Message<JsonObject>> reply) {
            JsonObject replyBody = reply.result().body();
            if (OK.equals(replyBody.getString(STATUS))) {
                ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON);
                ctx.response().end(decode(reply.result().body().getString(VALUE)));
            } else {
                ctx.response().setStatusCode(StatusCode.NOT_FOUND.getStatusCode());
                ctx.response().setStatusMessage(StatusCode.NOT_FOUND.getStatusMessage());
                ctx.response().end("Not Found");
            }
        }
    });
});

The following line is wrong, since it only works for indices from 0 to 99

final String queue = lastPart(ctx.request().path().substring(0, ctx.request().path().length() - 2), "/");

Making a request like this

GET /playground/queues/my_queue/500

would result in a queuename with value 5 instead of my_queue.

@mcweba mcweba added the bug label Jul 1, 2016
mcweba added a commit that referenced this issue Jun 4, 2024
…wser

#49 Fixed bug in QueueBrowser by deleting it. Is deprecated since 2021
mcweba added a commit that referenced this issue Jun 5, 2024
mcweba added a commit that referenced this issue Jun 5, 2024
mcweba added a commit that referenced this issue Jun 5, 2024
@mcweba
Copy link
Collaborator Author

mcweba commented Jun 7, 2024

Fixed in v2.1.8 by removing the deprecated QueueBrowser class

@mcweba mcweba closed this as completed Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant