The reason why Gandalf left the ring with Bilbo and then Frodo for so many years is because he wasn’t really sure what it was. Yet, when Bilbo acted weird, he became suspicious, so he ended up travelling all the way to Minas Tirith to read about rings.
This is the place where Isildur ruled at one point, so it makes sense that knowledge of the ring resided there.
Note that it’s roughly 1000 miles from Minas Tirith to the Shire, so that’s a heck of a trip to visit the library!
Found this here, but am not sure who the author is.
There are no less than 3 sources of fire in that image containing a room full of extremely dry documents that are likely to all be hundreds to possibly thousands of years old. Librarians were much more lax in those days I guess.
That said, I suppose Gandalf had the ring of fire, so he could control the fire and prevent it from doing any damage.