(Reuters) — Many actors think there ought to be a law against posting their ages online, and California has obliged critics of ageism in Hollywood with legislation targeting a leading online source for information on movie and television figures.

The law, passed earlier this year, has been challenged in a lawsuit by the company IMDb, which is owned by Amazon and operates a repository of information on the film and television industry.

The lawsuit filed on Thursday in federal court for the Northern District of California alleges the legislation violates free speech rights under the U.S. Constitution.

The bill, which supporters described as an effort to prevent age discrimination, requires officials at IMDb.com to remove from the website the ages of figures in the entertainment industry, including actors, directors and writers, if those individuals request the deletion.

Actors and others in Hollywood have long complained they are passed over for roles as they get older, in an industry that values youth and beauty.

Female performers in particular say a double standard gives women fewer opportunities as they age, while men can still land leading roles in movies and television shows late in their careers.

“By the time you’re 28 you’re expired, you’re playing mommy roles,” actress Zoe Saldana, now 38 and female lead of the blockbuster film “Guardians of the Galaxy,” told The Telegraph in 2014.

The lawsuit said the law, known as AB 1687, was unfair because it was carefully tailored to apply only to the Delaware-based IMDb.com Inc, and not other sources of information such as media websites.

“IMDb shares the worthy goal of preventing age discrimination,” the lawsuit stated. “But AB 1687 is an unconstitutional law that does not advance, much less achieve, that goal.”

The lawsuit seeks a court judgment blocking enforcement of the law. It names the California attorney general as a defendant.

Brenda Gonzalez, a spokeswoman for Attorney General Kamala Harris, said in an email Harris’ office was reviewing the complaint.

The Screen Actors Guild-American Federation of Television and Radio Artists lobbied for passage of the bill.

A representative for the union could not be reached for comment.

In 2013, a jury in Seattle ruled in favor IMDb in an age discrimination lawsuit by actress Huong Hoang, known professionally as Junie Hoang, who did not want her age listed on the site, according to media reports at the time.

(Reporting by Alex Dobuzinskis; Editing by David Gregorio)