In a rare and remarkable display of bipartisanship, the House voted unanimously this week to strengthen a 30-year-old privacy law that governs how and when law enforcement agencies can obtain access to emails, photographs and other documents that people store online. If enacted, the changes will ensure that the law protects digital information as well as it does physical documents.

The bill will require law enforcement agencies to obtain search warrants from judges to gain access to personal messages and files stored on the servers of companies like Google, Yahoo and Dropbox. The legislation would substantially revise a 1986 law, the Electronic Communications Privacy Act, that allows agencies to get emails older than 180 days and other digital files by issuing subpoenas to technology companies without going to a judge.

This sensible update reflects how people store information today. And some courts have already recognized the principle that emails and files kept in the cloud should receive the same protection under the law as documents left in filing cabinets and closets. In 2010, the United States Court of Appeals for the Sixth Circuit ruled that the government must obtain warrants before searching emails stored online. But that ruling was not appealed to the Supreme Court, so it did not establish national precedent.

The bill is not perfect. When it was introduced, it required law enforcement agencies to notify people that their digital data had been obtained through a warrant. That provision was removed before the House voted on the bill because of law enforcement opposition. Technology companies, however, will be allowed to notify their customers about warrants.