INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: MCWS: Files/SetInfo deletes values if it cannot parse them?  (Read 839 times)

DrKNo

  • World Citizen
  • ***
  • Posts: 201
MCWS: Files/SetInfo deletes values if it cannot parse them?
« on: August 06, 2020, 12:16:26 pm »

Sorry about making another post in short succession, but this one might be critical. The following query quietly erases the date field from the jriver instance:

http://127.0.0.1:52199/MCWS/v1/File/SetInfo?File=511&FileType=Key&Field=Date&Value=%2242380%22

Probably because the date is needlessly escaped with %22. I feel like this call should have no effect on the database or at least throw an error.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42372
  • Shoes gone again!
Re: MCWS: Files/SetInfo deletes values if it cannot parse them?
« Reply #1 on: August 06, 2020, 12:21:49 pm »

That has a value of "42380" going into the set.  Setting the date to that is non-sense, so it empties.

Try "8/6/2020" or something that's an actual date.
Logged
Matt Ashland, JRiver Media Center

DrKNo

  • World Citizen
  • ***
  • Posts: 201
Re: MCWS: Files/SetInfo deletes values if it cannot parse them?
« Reply #2 on: August 06, 2020, 12:27:14 pm »

Its an unformatted timestamp. Sending it without the quotes works fine.

Either way, "Doesn't parse, delete" seems dangerous to me? Shouldn't this result in a cancelled operation?

I don't depend on this change by the way, my code works fine thanks to your input. Just seemed dangerous to me.

Specifically, this url works for me:
http://127.0.0.1:52199/MCWS/v1/File/SetInfo?File=511&FileType=Key&Field=Date&Value=42400


Sorry, I only finally got your intention. Yes, of course the string content is nonsense. But deleting the value still seems dangerous to me
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42372
  • Shoes gone again!
Re: MCWS: Files/SetInfo deletes values if it cannot parse them?
« Reply #3 on: August 06, 2020, 01:03:31 pm »

Alright, I'll make the next build of v26 have this change:
Changed: Passing an invalid date to the SetInfo call will return <Response Status="Failure"/> instead of setting an empty date.
Logged
Matt Ashland, JRiver Media Center

DrKNo

  • World Citizen
  • ***
  • Posts: 201
Re: MCWS: Files/SetInfo deletes values if it cannot parse them?
« Reply #4 on: August 06, 2020, 01:38:17 pm »

Thank you, Matt! Much appreciated, as always.
Logged
Pages: [1]   Go Up