Skip to content

Webmachine::QuotedString#quote fails when trying to quote request.if_match when it's nil #201

@jfredett

Description

@jfredett

My resource ends up failing in state g9 because request.if_match is nil. This can be fixed by changing:

        # Escapes quotes within a quoted string.
        def escape_quotes(str)
          str.gsub(/"/, '\\"')
        end

        # Unescapes quotes within a quoted string
        def unescape_quotes(str)
          str.gsub(%r{\\}, '')
        end

with

        # Escapes quotes within a quoted string.
        def escape_quotes(str)
          String(str).gsub(/"/, '\\"')
        end

        # Unescapes quotes within a quoted string
        def unescape_quotes(str)
          String(str).gsub(%r{\\}, '')
        end

But I'm not totally confident I'm doing everything correctly. Totally willing to make the change, but I want to confirm that this is, indeed, unexpected behavior. At the very least, this seems to cause a 415 to be returned, even though I suspect it should return something in the 500-series (since this is a server-side problem).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions