ert icon indicating copy to clipboard operation
ert copied to clipboard

Re-transmitting storage transmitter might cause invalid URL

Open jondequinor opened this issue 3 years ago • 0 comments

Describe the bug

To my eyes, if I call _transmit_numerical_record or _transmit_blob_record multiple times (maybe due to networking errors or whatever), you might append f"{self._uri}?realization_index={self._real_id}" multiple times.

    async def _transmit_numerical_record(self, record: ert.data.NumericalRecord) -> str:
        url = f"{self._uri}/matrix"
        if self._real_id is not None:
            url = f"{url}?realization_index={self._real_id}"
            self._uri = f"{self._uri}?realization_index={self._real_id}"
        await add_record(url, record)
        return self._uri

    async def _transmit_blob_record(self, record: ert.data.BlobRecord) -> str:
        url = f"{self._uri}/file"
        if self._real_id is not None:
            url = f"{url}?realization_index={self._real_id}"
            self._uri = f"{self._uri}?realization_index={self._real_id}"
        await add_record(url, record)
        return self._uri

To Reproduce Supply a bad URL to the transmitter, should end up with …/realization_index=n?realization_index=n?realization_index=n?realization_index=n?.

Expected behavior Transmission should have no side effects on the transmitter object as far as these methods are concerned. State is mutated outside of these methods.

jondequinor avatar Oct 15 '21 20:10 jondequinor