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

File.exists? removed in Ruby 3.2 #97

Open
SeanLF opened this issue Jun 29, 2023 · 0 comments · May be fixed by #98
Open

File.exists? removed in Ruby 3.2 #97

SeanLF opened this issue Jun 29, 2023 · 0 comments · May be fixed by #98

Comments

@SeanLF
Copy link

SeanLF commented Jun 29, 2023

After upgrading to Ruby 3.2, we had the following error pop up in Sentry:

NoMethodError: undefined method `exists?' for File:Class (NoMethodError)

          File.delete(ssl_filename) if File.exists?(ssl_filename)
                                           ^^^^^^^^
Did you mean?  exist?
  from rubycas-client (2.3.9) lib/casclient/tickets/storage.rb:129:in `cleanup_service_session_lookup'

According to Ruby 3.2's changelogs, File.exists has been removed:

Removed methods
The following deprecated methods are removed.

[...]
File.exists? [Feature #17391]


There are two references to File.exists? in the codebase, which need to be updated to File.exist?

return IO.read(ssl_filename) if File.exists?(ssl_filename)
end
# Removes a stored relationship between a ServiceTicket and a local
# Rails session id. This should be called when the session is being
# closed.
#
# See #store_service_session_lookup.
def cleanup_service_session_lookup(st)
raise CASException, "No service_ticket specified." if st.nil?
st = st.ticket if st.kind_of? ServiceTicket
ssl_filename = filename_of_service_session_lookup(st)
File.delete(ssl_filename) if File.exists?(ssl_filename)

@SeanLF SeanLF linked a pull request Jun 29, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant